I am using LightningChart Python and I am drawing a “body map” using a background image and multiple point-series markers that use custom images for chest, ankle and arm icons.
The background image scales correctly when the window is resized, but the marker images keep their original size, so they look too big or too small after resizing.
How can I make the marker images automatically scale to maintain correct proportions relative to the chart size?
import lightningchart as lc
chart = lc.ChartXY(theme=lc.Themes.Light, title='ChartXY', legend={'add_entries_automatically': False})
chart.get_default_x_axis().set_interval(0, 20, stop_axis_after=True).set_tick_strategy('Empty')
chart.get_default_y_axis().set_interval(0, 20, stop_axis_after=True).set_tick_strategy('Empty')
chart.set_series_background_image(
source='body.png',
fit_mode='Fit',
)
BASE_IMAGE_SIZE = 0.5
def add_marker(point, image_path):
series = chart.add_point_series(colors=True, sizes=True)
series.add(*point)
series.set_point_image_style(source=image_path)
series.set_point_size(BASE_IMAGE_SIZE)
return series
markers = [
add_marker((10.000, 10.500), 'chest.png'),
add_marker((10.315, 5.000), 'left_ankle.png'),
add_marker((10.940, 11.355), 'left_arm.png'),
add_marker((10.005, 13.100), 'right_arm.png'),
]
chart.open(live=True)
https://lightningchart.com/python-charts/docs/features/chart-xy/point/#set-custom-point-shape