GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_line_chart_axis_draw.c Lines: 12 12 100.0 %
Date: 2026-03-06 19:21:09 Branches: 0 0 - %

Line Branch Exec Source
1
/***************************************************************************
2
 * Copyright (c) 2024 Microsoft Corporation
3
 * Copyright (c) 2026-present Eclipse ThreadX contributors
4
 *
5
 * This program and the accompanying materials are made available under the
6
 * terms of the MIT License which is available at
7
 * https://opensource.org/licenses/MIT.
8
 *
9
 * SPDX-License-Identifier: MIT
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
/**************************************************************************/
68
1452
VOID _gx_line_chart_axis_draw(GX_LINE_CHART *chart)
69
{
70
GX_VALUE            center;
71
GX_LINE_CHART_INFO *chart_info;
72
73
1452
    chart_info = &chart -> gx_line_chart_info;
74
75
1452
    _gx_context_brush_define(chart_info -> gx_line_chart_axis_color, chart_info -> gx_line_chart_axis_color, 0);
76
1452
    _gx_context_brush_width_set((UINT)(chart_info -> gx_line_chart_axis_line_width));
77
78
    /* draw the Y axis on the left side */
79
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));
80
1452
    _gx_canvas_line_draw(center,
81
1452
                         (GX_VALUE)(chart -> gx_widget_size.gx_rectangle_top + chart_info -> gx_line_chart_top_margin),
82
                         center,
83
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));
84
85
    /* draw the X axis along the bottom */
86
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));
87
1452
    _gx_canvas_line_draw((GX_VALUE)(chart -> gx_widget_size.gx_rectangle_left + chart_info -> gx_line_chart_left_margin),
88
                         center,
89
1452
                         (GX_VALUE)(chart -> gx_widget_size.gx_rectangle_right - chart_info -> gx_line_chart_right_margin),
90
                         center);
91
1452
}
92