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