Class DefaultTernaryChartModel
java.lang.Object
com.arbergashi.charts.model.DefaultTernaryChartModel
- All Implemented Interfaces:
ChartModel, TernaryChartModel
Default implementation for a ternary chart model.
- Since:
- 2025-06-01
- Version:
- 1.0.0
- Author:
- Arber Gashi
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA simple, immutable implementation of TernaryPoint.Nested classes/interfaces inherited from interface ChartModel
ChartModel.ChartModelListenerNested classes/interfaces inherited from interface TernaryChartModel
TernaryChartModel.TernaryPoint -
Field Summary
Fields inherited from interface ChartModel
EMPTY_DOUBLE -
Constructor Summary
ConstructorsConstructorDescriptionDefaultTernaryChartModel(List<TernaryChartModel.TernaryPoint> data, List<String> componentLabels) -
Method Summary
Modifier and TypeMethodDescriptionvoidRegisters a listener for data changes.voidaddPoint(ChartPoint point) voidaddPoints(List<ChartPoint> points) voidclear()getColor()Optional visual color for a series; default is null.Returns the labels for the three components (corners of the triangle).getName()Returns the title of the data series.intReturns the number of data points.Returns the data as a list of ternary points.longOptional timestamp for model updates; default 0 for simple models.doublegetX(int index) Returns the X value at the given index.doublegetY(int index) Returns the Y value at the given index.voidRemoves a listener.voidOptional setter for a visual color; default no-op.voidvoidsetPoints(List<ChartPoint> points) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ChartModel
getDataRange, getHighData, getLabel, getLowData, getMax, getMin, getOpenData, getValue, getWeight, getWeightData, getXData, getY, getYData, isEmpty
-
Constructor Details
-
DefaultTernaryChartModel
public DefaultTernaryChartModel(List<TernaryChartModel.TernaryPoint> data, List<String> componentLabels)
-
-
Method Details
-
getTernaryData
Description copied from interface:TernaryChartModelReturns the data as a list of ternary points.- Specified by:
getTernaryDatain interfaceTernaryChartModel- Returns:
- A list of TernaryPoint objects.
-
getComponentLabels
Description copied from interface:TernaryChartModelReturns the labels for the three components (corners of the triangle).- Specified by:
getComponentLabelsin interfaceTernaryChartModel- Returns:
- A list of three labels for components A, B, and C.
-
getName
Description copied from interface:ChartModelReturns the title of the data series.- Specified by:
getNamein interfaceChartModel- Returns:
- Name of the series
-
setName
-
getColor
Description copied from interface:ChartModelOptional visual color for a series; default is null.- Specified by:
getColorin interfaceChartModel
-
setColor
Description copied from interface:ChartModelOptional setter for a visual color; default no-op.- Specified by:
setColorin interfaceChartModel
-
getUpdateStamp
public long getUpdateStamp()Description copied from interface:ChartModelOptional timestamp for model updates; default 0 for simple models.- Specified by:
getUpdateStampin interfaceChartModel
-
getPointCount
public int getPointCount()Description copied from interface:ChartModelReturns the number of data points.- Specified by:
getPointCountin interfaceChartModel- Returns:
- count
-
getX
public double getX(int index) Description copied from interface:ChartModelReturns the X value at the given index.- Specified by:
getXin interfaceChartModel- Parameters:
index- data point index- Returns:
- X value or 0.0 if out of range
-
getY
public double getY(int index) Description copied from interface:ChartModelReturns the Y value at the given index.- Specified by:
getYin interfaceChartModel- Parameters:
index- data point index- Returns:
- Y value or 0.0 if out of range
-
addPoint
-
addPoints
-
setPoints
-
clear
public void clear() -
addChangeListener
Description copied from interface:ChartModelRegisters a listener for data changes.- Specified by:
addChangeListenerin interfaceChartModel- Parameters:
listener- The listener
-
removeChangeListener
Description copied from interface:ChartModelRemoves a listener.- Specified by:
removeChangeListenerin interfaceChartModel- Parameters:
listener- The listener
-