1 /*
2 * Tethys: GUI Utilities
3 * Copyright 2012-2026. Tony Washer
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy
7 * of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17 package io.github.tonywasher.joceanus.tethys.api.chart;
18
19 import io.github.tonywasher.joceanus.oceanus.decimal.OceanusMoney;
20 import io.github.tonywasher.joceanus.oceanus.event.OceanusEventRegistrar.OceanusEventProvider;
21 import io.github.tonywasher.joceanus.tethys.api.base.TethysUIComponent;
22 import io.github.tonywasher.joceanus.tethys.api.base.TethysUIEvent;
23
24 import java.util.Iterator;
25
26 /**
27 * Bar Chart.
28 * <p>
29 * The EventProvider fires the following events.
30 * <ul>
31 * <li>TethysUIEvent.PRESSED is fired when a bar is selected
32 * </ul>
33 */
34 public interface TethysUIBarChart
35 extends OceanusEventProvider<TethysUIEvent>, TethysUIComponent {
36 /**
37 * Update BarChart with data.
38 *
39 * @param pData the data
40 */
41 void updateBarChart(TethysUIBarChartData pData);
42
43 /**
44 * BarChart Data.
45 */
46 interface TethysUIBarChartData {
47 /**
48 * Set the XAxis label.
49 *
50 * @param pLabel the label.
51 * @return the data
52 */
53 TethysUIBarChartData setXAxisLabel(String pLabel);
54
55 /**
56 * Set the YAxis label.
57 *
58 * @param pLabel the label.
59 * @return the data
60 */
61 TethysUIBarChartData setYAxisLabel(String pLabel);
62
63 /**
64 * Obtain the title.
65 *
66 * @return the title.
67 */
68 String getTitle();
69
70 /**
71 * Obtain the XAxis label.
72 *
73 * @return the label.
74 */
75 String getXAxisLabel();
76
77 /**
78 * Obtain the YAxis label.
79 *
80 * @return the label.
81 */
82 String getYAxisLabel();
83
84 /**
85 * Add a series.
86 *
87 * @param pName the name
88 * @return the series
89 */
90 TethysUIBarChartSeries createSeries(String pName);
91
92 /**
93 * Obtain the barChart series.
94 *
95 * @return the iterator
96 */
97 Iterator<TethysUIBarChartSeries> seriesIterator();
98 }
99
100 /**
101 * The Series definition.
102 */
103 interface TethysUIBarChartSeries {
104 /**
105 * Add a dataSection.
106 *
107 * @param pRef the reference
108 * @param pValue the value
109 */
110 void addSection(String pRef,
111 OceanusMoney pValue);
112
113 /**
114 * Add a dataSection.
115 *
116 * @param pRef the reference
117 * @param pValue the value
118 * @param pSource the source
119 */
120 void addSection(String pRef,
121 OceanusMoney pValue,
122 Object pSource);
123
124 /**
125 * Obtain the name.
126 *
127 * @return the name.
128 */
129 String getName();
130
131 /**
132 * Obtain the barChartSeries sections.
133 *
134 * @return the iterator
135 */
136 Iterator<TethysUIBarChartDataSection> sectionIterator();
137 }
138
139 /**
140 * The Data Section definition.
141 */
142 interface TethysUIBarChartDataSection {
143 /**
144 * Obtain the series.
145 *
146 * @return the series.
147 */
148 TethysUIBarChartSeries getSeries();
149
150 /**
151 * Obtain the reference.
152 *
153 * @return the reference.
154 */
155 String getReference();
156
157 /**
158 * Obtain the value.
159 *
160 * @return the value.
161 */
162 OceanusMoney getValue();
163
164 /**
165 * Obtain the source.
166 *
167 * @return the source.
168 */
169 Object getSource();
170 }
171 }