Delete this section if you read and applied the mentioned points.
Description
What MCU/Processor/Board and compiler are you using?
Currently I am using MicroPython, I am going to use C.
What LVGL version are you using?
master
What do you want to achieve?
I want to adjust the bar spacing within the chart.
What have you tried so far?
Code to reproduce
Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.
The code block(s) should be formatted like:
##### startup script #####
import lvgl as lv
import display_driver
##### main script #####
def draw_event_cb(e):
dsc = lv.obj_draw_part_dsc_t.__cast__(e.get_param())
if dsc.part == lv.PART.TICKS and dsc.id == lv.chart.AXIS.PRIMARY_X:
time = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12","13","14","15","16","17","18","19","20","21","22","23","24"]
dsc.text = bytes(time[dsc.value],"ascii")
#
# Add ticks and labels to the axis and demonstrate scrolling
#
# Create a chart
chart = lv.chart(lv.scr_act())
chart.set_size(350, 150)
chart.center()
chart.set_type(lv.chart.TYPE.BAR)
chart.set_range(lv.chart.AXIS.PRIMARY_Y, 10, 100)
chart.set_point_count(24)
chart.add_event_cb(draw_event_cb, lv.EVENT.DRAW_PART_BEGIN, None)
# Add ticks and label to every axis
chart.set_axis_tick(lv.chart.AXIS.PRIMARY_X, 0, 0, 24, 1, True, 24)
# Zoom in a little in X
#chart.set_zoom_x(300)
# Add two data series
ser1 = lv.chart.add_series(chart, lv.palette_lighten(lv.PALETTE.GREEN, 2), lv.chart.AXIS.PRIMARY_Y)
# Set the next points on 'ser1'
chart.set_next_value(ser1,00)
chart.set_next_value(ser1,10)
chart.set_next_value(ser1,20)
chart.set_next_value(ser1,30)
chart.set_next_value(ser1,40)
chart.set_next_value(ser1,50)
chart.set_next_value(ser1,60)
chart.set_next_value(ser1,70)
chart.set_next_value(ser1,80)
chart.set_next_value(ser1,90)
chart.set_next_value(ser1,90)
chart.set_next_value(ser1,80)
chart.set_next_value(ser1,70)
chart.set_next_value(ser1,60)
chart.set_next_value(ser1,50)
chart.set_next_value(ser1,40)
chart.set_next_value(ser1,30)
chart.set_next_value(ser1,20)
chart.set_next_value(ser1,10)
chart.set_next_value(ser1,00)
chart.set_next_value(ser1,10)
chart.set_next_value(ser1,20)
chart.set_next_value(ser1,30)
chart.set_next_value(ser1,40)
chart.refresh() # Required after direct set
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.
ex)
I do not read&write English well.
I rely on Google Translate.
Thx