chore(style): remove the trailing space from all source files (#3188)
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
@@ -1,41 +1,41 @@
|
||||
|
||||
Line Chart
|
||||
Line Chart
|
||||
""""""""""
|
||||
|
||||
.. lv_example:: widgets/chart/lv_example_chart_1
|
||||
:language: c
|
||||
|
||||
|
||||
Faded area line chart with custom division lines
|
||||
|
||||
|
||||
Faded area line chart with custom division lines
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: widgets/chart/lv_example_chart_2
|
||||
:language: c
|
||||
|
||||
|
||||
Axis ticks and labels with scrolling
|
||||
""""""""""""""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: widgets/chart/lv_example_chart_3
|
||||
:language: c
|
||||
|
||||
|
||||
Show the value of the pressed points
|
||||
""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: widgets/chart/lv_example_chart_4
|
||||
:language: c
|
||||
|
||||
|
||||
Display 1000 data points with zooming and scrolling
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: widgets/chart/lv_example_chart_5
|
||||
:language: c
|
||||
|
||||
|
||||
Show cursor on the clicked point
|
||||
"""""""""""""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: widgets/chart/lv_example_chart_6
|
||||
:language: c
|
||||
|
||||
|
||||
Scatter chart
|
||||
"""""""""""""""""""""""""""""""""""
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
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:
|
||||
if dsc.part == lv.PART.TICKS and dsc.id == lv.chart.AXIS.PRIMARY_X:
|
||||
month = ["Jan", "Febr", "March", "Apr", "May", "Jun", "July", "Aug", "Sept", "Oct", "Nov", "Dec"]
|
||||
# dsc.text is defined char text[16], I must therefore convert the Python string to a byte_array
|
||||
dsc.text = bytes(month[dsc.value],"ascii")
|
||||
dsc.text = bytes(month[dsc.value],"ascii")
|
||||
#
|
||||
# Add ticks and labels to the axis and demonstrate scrolling
|
||||
#
|
||||
|
||||
@@ -18,7 +18,7 @@ def event_cb(e):
|
||||
chart.get_point_pos_by_id(series[i], id, p)
|
||||
value = series_points[i][id]
|
||||
buf = lv.SYMBOL.DUMMY + "$" + str(value)
|
||||
|
||||
|
||||
draw_rect_dsc = lv.draw_rect_dsc_t()
|
||||
draw_rect_dsc.init()
|
||||
draw_rect_dsc.bg_color = lv.color_black()
|
||||
@@ -26,7 +26,7 @@ def event_cb(e):
|
||||
draw_rect_dsc.radius = 3
|
||||
draw_rect_dsc.bg_img_src = buf
|
||||
draw_rect_dsc.bg_img_recolor = lv.color_white()
|
||||
|
||||
|
||||
a = lv.area_t()
|
||||
coords = lv.area_t()
|
||||
chart.get_coords(coords)
|
||||
@@ -34,14 +34,14 @@ def event_cb(e):
|
||||
a.x2 = coords.x1 + p.x + 20
|
||||
a.y1 = coords.y1 + p.y - 30
|
||||
a.y2 = coords.y1 + p.y - 10
|
||||
|
||||
|
||||
clip_area = lv.area_t.__cast__(e.get_param())
|
||||
lv.draw_rect(a, clip_area, draw_rect_dsc)
|
||||
|
||||
|
||||
elif code == lv.EVENT.RELEASED:
|
||||
chart.invalidate()
|
||||
|
||||
#
|
||||
|
||||
#
|
||||
# Add ticks and labels to the axis and demonstrate scrolling
|
||||
#
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ def slider_y_event_cb(e):
|
||||
# Display 1000 data points with zooming and scrolling.
|
||||
# See how the chart changes drawing mode (draw only vertical lines) when
|
||||
# the points get too crowded.
|
||||
|
||||
|
||||
# Create a chart
|
||||
chart = lv.chart(lv.scr_act())
|
||||
chart.set_size(200, 150)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class ExampleChart_6():
|
||||
|
||||
|
||||
def __init__(self):
|
||||
self.last_id = -1
|
||||
#
|
||||
@@ -9,21 +9,21 @@ class ExampleChart_6():
|
||||
chart = lv.chart(lv.scr_act())
|
||||
chart.set_size(200, 150)
|
||||
chart.align(lv.ALIGN.CENTER, 0, -10)
|
||||
|
||||
|
||||
chart.set_axis_tick(lv.chart.AXIS.PRIMARY_Y, 10, 5, 6, 5, True, 40)
|
||||
chart.set_axis_tick(lv.chart.AXIS.PRIMARY_X, 10, 5, 10, 1, True, 30)
|
||||
|
||||
|
||||
chart.add_event_cb(self.event_cb, lv.EVENT.ALL, None)
|
||||
chart.refresh_ext_draw_size()
|
||||
|
||||
|
||||
self.cursor = chart.add_cursor(lv.palette_main(lv.PALETTE.BLUE), lv.DIR.LEFT | lv.DIR.BOTTOM)
|
||||
|
||||
|
||||
self.ser = chart.add_series(lv.palette_main(lv.PALETTE.RED), lv.chart.AXIS.PRIMARY_Y)
|
||||
|
||||
self.ser_p = []
|
||||
for i in range(10):
|
||||
self.ser_p.append(lv.rand(10,90))
|
||||
self.ser.y_points = self.ser_p
|
||||
self.ser.y_points = self.ser_p
|
||||
|
||||
newser = chart.get_series_next(None)
|
||||
# print("length of data points: ",len(newser.points))
|
||||
@@ -32,8 +32,8 @@ class ExampleChart_6():
|
||||
label = lv.label(lv.scr_act())
|
||||
label.set_text("Click on a point")
|
||||
label.align_to(chart, lv.ALIGN.OUT_TOP_MID, 0, -5)
|
||||
|
||||
|
||||
|
||||
|
||||
def event_cb(self,e):
|
||||
|
||||
code = e.get_code()
|
||||
@@ -46,7 +46,7 @@ class ExampleChart_6():
|
||||
p = lv.point_t()
|
||||
chart.get_point_pos_by_id(self.ser, self.last_id, p)
|
||||
chart.set_cursor_point(self.cursor, None, self.last_id)
|
||||
|
||||
|
||||
elif code == lv.EVENT.DRAW_PART_END:
|
||||
# print("EVENT.DRAW_PART_END")
|
||||
dsc = lv.obj_draw_part_dsc_t.__cast__(e.get_param())
|
||||
@@ -57,25 +57,25 @@ class ExampleChart_6():
|
||||
if dsc.part == lv.PART.CURSOR and dsc.p1 and dsc.p2 and dsc.p1.y == dsc.p2.y and self.last_id >= 0:
|
||||
|
||||
v = self.ser_p[self.last_id]
|
||||
|
||||
|
||||
# print("value: ",v)
|
||||
value_txt = str(v)
|
||||
size = lv.point_t()
|
||||
lv.txt_get_size(size, value_txt, lv.font_default(), 0, 0, lv.COORD.MAX, lv.TEXT_FLAG.NONE)
|
||||
|
||||
|
||||
a = lv.area_t()
|
||||
a.y2 = dsc.p1.y - 5
|
||||
a.y1 = a.y2 - size.y - 10
|
||||
a.x1 = dsc.p1.x + 10
|
||||
a.x2 = a.x1 + size.x + 10
|
||||
|
||||
|
||||
draw_rect_dsc = lv.draw_rect_dsc_t()
|
||||
draw_rect_dsc.init()
|
||||
draw_rect_dsc.bg_color = lv.palette_main(lv.PALETTE.BLUE)
|
||||
draw_rect_dsc.radius = 3
|
||||
|
||||
|
||||
lv.draw_rect(a, dsc.clip_area, draw_rect_dsc)
|
||||
|
||||
|
||||
draw_label_dsc = lv.draw_label_dsc_t()
|
||||
draw_label_dsc.init()
|
||||
draw_label_dsc.color = lv.color_white()
|
||||
|
||||
@@ -12,7 +12,7 @@ def draw_event_cb(e):
|
||||
# print("cnt: ",cnt)
|
||||
# Make older value more transparent
|
||||
dsc.rect_dsc.bg_opa = (lv.OPA.COVER * dsc.id) // (cnt - 1)
|
||||
|
||||
|
||||
# Make smaller values blue, higher values red
|
||||
# x_array = chart.get_x_array(ser)
|
||||
# y_array = chart.get_y_array(ser)
|
||||
@@ -23,11 +23,11 @@ def draw_event_cb(e):
|
||||
# print("p_act", p_act)
|
||||
x_opa = (x_array[p_act] * lv.OPA._50) // 200
|
||||
y_opa = (y_array[p_act] * lv.OPA._50) // 1000
|
||||
|
||||
|
||||
dsc.rect_dsc.bg_color = lv.palette_main(lv.PALETTE.RED).color_mix(
|
||||
lv.palette_main(lv.PALETTE.BLUE),
|
||||
x_opa + y_opa)
|
||||
|
||||
|
||||
def add_data(timer,chart):
|
||||
# print("add_data")
|
||||
x = lv.rand(0,200)
|
||||
@@ -38,7 +38,7 @@ def add_data(timer,chart):
|
||||
x_array.append(x)
|
||||
y_array.pop(0)
|
||||
y_array.append(y)
|
||||
|
||||
|
||||
#
|
||||
# A scatter chart
|
||||
#
|
||||
@@ -66,7 +66,7 @@ y_array = []
|
||||
for i in range(50):
|
||||
x_array.append(lv.rand(0, 200))
|
||||
y_array.append(lv.rand(0, 1000))
|
||||
|
||||
|
||||
ser.x_points = x_array
|
||||
ser.y_points = y_array
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ def lv_example_chart_8():
|
||||
stacked_area_chart.obj.set_div_line_count(5, 7)
|
||||
stacked_area_chart.obj.add_event_cb( draw_event_cb, lv.EVENT.DRAW_PART_BEGIN, None)
|
||||
|
||||
# Set range to 0 to 100 for percentages. Draw ticks
|
||||
# Set range to 0 to 100 for percentages. Draw ticks
|
||||
stacked_area_chart.obj.set_range(lv.chart.AXIS.PRIMARY_Y,0,100)
|
||||
stacked_area_chart.obj.set_axis_tick(lv.chart.AXIS.PRIMARY_Y, 3, 0, 5, 1, True, 30)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user