How to change chart's bg line

Important: unclear posts may not receive useful answers.

Before posting

  • Get familiar with Markdown to format and structure your post
  • Be sure to update lvgl from the latest version from the master branch.
  • Be sure you have checked the FAQ and read the relevant part of the documentation.
  • If applicable use the Simulator to eliminate hardware related issues.

Delete this section if you read and applied the mentioned points.

Description

What MCU/Processor/Board and compiler are you using?

nrf/zephy

What LVGL version are you using?

lVGL 8.2

What do you want to achieve?

I want to change the color of the line.

What have you tried so far?

i find documents

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:

    lv_obj_t * chart;
    chart = lv_chart_create(ui_bazal_screen);
    lv_obj_set_size(chart, 350, 50);
    lv_obj_center(chart);
    lv_obj_set_y(chart, -50);
    lv_chart_set_type(chart, LV_CHART_TYPE_BAR);
    lv_chart_set_range(chart, LV_CHART_AXIS_PRIMARY_Y, 10, 100);
    lv_chart_set_point_count(chart, 24);
    lv_obj_set_style_bg_opa(chart, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_border_opa(chart, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_chart_set_axis_tick(chart, LV_CHART_AXIS_PRIMARY_Y, 0, 0, 10, 1, true, 0);

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

I want to change the color of these

Can you tell me what I need to add?

Thx

It’s the lv_obj_set_style_line_color(chart, color, LV_PART_MAIN | LV_STATE_DEFAULT); property.
See Chart (lv_chart) — LVGL documentation

1 Like

Thank you for always helping me inexperienced :+1:

1 Like