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.date.OceanusDate;
20 import io.github.tonywasher.joceanus.oceanus.decimal.OceanusMoney;
21 import io.github.tonywasher.joceanus.oceanus.event.OceanusEventRegistrar.OceanusEventProvider;
22 import io.github.tonywasher.joceanus.tethys.api.base.TethysUIComponent;
23 import io.github.tonywasher.joceanus.tethys.api.base.TethysUIEvent;
24
25 import java.util.Iterator;
26
27 /**
28 * Area Chart.
29 * <p>
30 * The EventProvider fires the following events.
31 * <ul>
32 * <li>TethysUIEvent.PRESSED is fired when a series is selected
33 * </ul>
34 */
35 public interface TethysUIAreaChart
36 extends OceanusEventProvider<TethysUIEvent>, TethysUIComponent {
37 /**
38 * Update AreaChart with data.
39 *
40 * @param pData the data
41 */
42 void updateAreaChart(TethysUIAreaChartData pData);
43
44 /**
45 * AreaChart Data.
46 */
47 interface TethysUIAreaChartData {
48 /**
49 * Set the XAxis label.
50 *
51 * @param pLabel the label.
52 * @return the data
53 */
54 TethysUIAreaChartData setXAxisLabel(String pLabel);
55
56 /**
57 * Set the YAxis label.
58 *
59 * @param pLabel the label.
60 * @return the data
61 */
62 TethysUIAreaChartData setYAxisLabel(String pLabel);
63
64 /**
65 * Obtain the title.
66 *
67 * @return the title.
68 */
69 String getTitle();
70
71 /**
72 * Obtain the XAxis label.
73 *
74 * @return the label.
75 */
76 String getXAxisLabel();
77
78 /**
79 * Obtain the YAxis label.
80 *
81 * @return the label.
82 */
83 String getYAxisLabel();
84
85 /**
86 * Create a series.
87 *
88 * @param pName the name
89 * @return the series
90 */
91 default TethysUIAreaChartSeries createSeries(final String pName) {
92 return createSeries(pName, pName);
93 }
94
95 /**
96 * Create a series.
97 *
98 * @param pName the name
99 * @param pSource the source
100 * @return the series
101 */
102 TethysUIAreaChartSeries createSeries(String pName,
103 Object pSource);
104
105 /**
106 * Obtain the areaChart series.
107 *
108 * @return the iterator
109 */
110 Iterator<TethysUIAreaChartSeries> seriesIterator();
111 }
112
113 /**
114 * The Series definition.
115 */
116 interface TethysUIAreaChartSeries {
117 /**
118 * Add a dataPoint.
119 *
120 * @param pDate the date
121 * @param pValue the value
122 */
123 void addPoint(OceanusDate pDate,
124 OceanusMoney pValue);
125
126 /**
127 * Obtain the name.
128 *
129 * @return the name.
130 */
131 String getName();
132
133 /**
134 * Obtain the source.
135 *
136 * @return the source.
137 */
138 Object getSource();
139
140 /**
141 * Obtain the areaChartSeries points.
142 *
143 * @return the iterator
144 */
145 Iterator<TethysUIAreaChartDataPoint> pointIterator();
146 }
147
148 /**
149 * The Data Point definition.
150 */
151 interface TethysUIAreaChartDataPoint {
152 /**
153 * Obtain the series.
154 *
155 * @return the series.
156 */
157 TethysUIAreaChartSeries getSeries();
158
159 /**
160 * Obtain the date.
161 *
162 * @return the date.
163 */
164 OceanusDate getDate();
165
166 /**
167 * Obtain the value.
168 *
169 * @return the value.
170 */
171 OceanusMoney getValue();
172 }
173 }