1 /**************************************************************************/
2 /* */
3 /* Copyright (c) Microsoft Corporation. All rights reserved. */
4 /* */
5 /* This software is licensed under the Microsoft Software License */
6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */
7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
8 /* and in the root directory of this software. */
9 /* */
10 /**************************************************************************/
11
12
13 /**************************************************************************/
14 /**************************************************************************/
15 /** */
16 /** GUIX Component */
17 /** */
18 /** Line Chart Management (Line Chart) */
19 /** */
20 /**************************************************************************/
21
22 #define GX_SOURCE_CODE
23
24
25 /* Include necessary system files. */
26
27 #include "gx_api.h"
28 #include "gx_context.h"
29 #include "gx_canvas.h"
30 #include "gx_window.h"
31 #include "gx_line_chart.h"
32
33
34
35 /**************************************************************************/
36 /* */
37 /* FUNCTION RELEASE */
38 /* */
39 /* _gx_line_chart_axis_draw PORTABLE C */
40 /* 6.1 */
41 /* AUTHOR */
42 /* */
43 /* Kenneth Maxwell, Microsoft Corporation */
44 /* */
45 /* DESCRIPTION */
46 /* */
47 /* This function draws the x,y chart axis of a line chart */
48 /* */
49 /* INPUT */
50 /* */
51 /* chart Line chart */
52 /* */
53 /* OUTPUT */
54 /* */
55 /* None */
56 /* */
57 /* CALLS */
58 /* */
59 /* _gx_context_brush_define */
60 /* _gx_context_brush_width_set */
61 /* _gx_canvas_line_draw */
62 /* */
63 /* CALLED BY */
64 /* */
65 /* Application Code */
66 /* */
67 /* RELEASE HISTORY */
68 /* */
69 /* DATE NAME DESCRIPTION */
70 /* */
71 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
72 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
73 /* resulting in version 6.1 */
74 /* */
75 /**************************************************************************/
_gx_line_chart_axis_draw(GX_LINE_CHART * chart)76 VOID _gx_line_chart_axis_draw(GX_LINE_CHART *chart)
77 {
78 GX_VALUE center;
79 GX_LINE_CHART_INFO *chart_info;
80
81 chart_info = &chart -> gx_line_chart_info;
82
83 _gx_context_brush_define(chart_info -> gx_line_chart_axis_color, chart_info -> gx_line_chart_axis_color, 0);
84 _gx_context_brush_width_set((UINT)(chart_info -> gx_line_chart_axis_line_width));
85
86 /* draw the Y axis on the left side */
87 center = (GX_VALUE)(chart -> gx_widget_size.gx_rectangle_left + chart_info -> gx_line_chart_left_margin + (chart_info -> gx_line_chart_axis_line_width / 2));
88 _gx_canvas_line_draw(center,
89 (GX_VALUE)(chart -> gx_widget_size.gx_rectangle_top + chart_info -> gx_line_chart_top_margin),
90 center,
91 (GX_VALUE)(chart -> gx_widget_size.gx_rectangle_bottom - chart_info -> gx_line_chart_bottom_margin - chart_info -> gx_line_chart_axis_line_width + (GX_VALUE)1));
92
93 /* draw the X axis along the bottom */
94 center = (GX_VALUE)(chart -> gx_widget_size.gx_rectangle_bottom - chart_info -> gx_line_chart_bottom_margin - (chart_info -> gx_line_chart_axis_line_width / 2));
95 _gx_canvas_line_draw((GX_VALUE)(chart -> gx_widget_size.gx_rectangle_left + chart_info -> gx_line_chart_left_margin),
96 center,
97 (GX_VALUE)(chart -> gx_widget_size.gx_rectangle_right - chart_info -> gx_line_chart_right_margin),
98 center);
99 }
100
101