minor fixes

This commit is contained in:
Gabor Kiss-Vamosi
2021-03-10 09:44:17 +01:00
parent 94431f8aaf
commit 22c06a19bc
9 changed files with 63 additions and 51 deletions

View File

@@ -66,6 +66,7 @@ void lv_example_chart_2(void)
lv_chart_set_type(chart1, LV_CHART_TYPE_LINE); /*Show lines and points too*/
lv_obj_add_event_cb(chart1, event_cb, NULL);
lv_chart_set_update_mode(chart1, LV_CHART_UPDATE_MODE_CIRCULAR);
/*Add two data series*/
ser1 = lv_chart_add_series(chart1, lv_color_red(), LV_CHART_AXIS_PRIMARY_Y);

View File

@@ -6,9 +6,9 @@ static void event_cb(lv_obj_t * chart, lv_event_t e)
LV_UNUSED(chart);
if(e == LV_EVENT_DRAW_PART_BEGIN) {
lv_obj_draw_hook_dsc_t * hook_dsc = lv_event_get_param();
if(hook_dsc->part == LV_PART_MARKER && hook_dsc->sub_part_id == LV_CHART_AXIS_X) {
if(hook_dsc->part == LV_PART_MARKER && hook_dsc->id == LV_CHART_AXIS_X) {
const char * month[] = {"Jan", "Febr", "March", "Apr", "May", "Jun", "July", "Aug", "Sept", "Oct", "Nov", "Dec"};
lv_snprintf(hook_dsc->text, sizeof(hook_dsc->text), "%s", month[hook_dsc->id]);
lv_snprintf(hook_dsc->text, sizeof(hook_dsc->text), "%s", month[hook_dsc->value]);
}
}
}