Description
What MCU/Processor/Board and compiler are you using?
VisualStudio Simulator
What LVGL version are you using?
v8
What do you want to achieve?
Change the color of axis (includse tick and label text)
For example, I want to have a chart with red axis and red label text.
BTW, Could the primary axis and the second be set with different color ?
What have you tried so far?
set the text color of a style and add it to the chart obj.
But it does not work!
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:
/*You code here*/
static lv_style_t style_chart_op;
lv_style_init(&style_chart_op);
lv_style_set_text_color(&style_chart_op, lv_color_make(255, 0, 0));
chart_op = lv_chart_create(parent);
//lv_obj_add_style(chart_op, &style_chart_op,0);
lv_obj_set_width(chart_op, lv_pct(92));//640
lv_obj_set_height(chart_op, lv_pct(90) );//300
lv_obj_set_style_opa(chart_op, 150, 0);
lv_obj_set_style_bg_color(chart_op, lv_color_make(200,50,10), 0);
lv_obj_set_style_bg_grad_color(chart_op, lv_color_make(10, 100, 200), 0);
lv_obj_set_style_bg_grad_dir(chart_op, LV_GRAD_DIR_VER,0);
lv_obj_set_scrollbar_mode(chart_op, LV_SCROLL_SNAP_NONE);
lv_obj_add_style(chart_op, &style_chart_op, 0);
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.
I have modified all of the line color in chart (includes the grid line in chart)via following
else if (code == LV_EVENT_DRAW_PART_BEGIN){
lv_obj_draw_part_dsc_t* dsc_chart = lv_event_get_draw_part_dsc(e);
if (dsc_chart->part = LV_PART_TICKS) {
dsc_chart->line_dsc->color = lv_color_make(255, 0, 0);
}
}
I think that the color of label text can be set by the same way but I can not find that exactly.
But It can not set axis with different color.
Thank you very much!