I've tried to make a custom version of a BarChart. On a first try I've extended BarChart, but this was a bad idea. So I thought to make it better and take XYChart to extend. After that I copied the source from BarChart to my custom chart class (in another package than javafx.scene.chart). And then I get a lot of errors in Netbeans, that was ok. Now I've tried to solve these errors in my custom chart impl, but a lot of code is package protected in XYChart / XYChart.Series / XYChart.Data that should be public to have a base class.
As I've seen some code is package protected but in the comment is the meaning the opposite. Like this one in XYChart.Data:
/**
* The current displayed data value plotted on the X axis. This may be the same as xValue or different. It is
* used by XYChart to animate the xValue from the old value to the new value. This is what you should plot
* in any custom XYChart implementations. Some XYChart chart implementations such as LineChart also use this
* to animate when data is added or removed.
*/
private ObjectProperty<X> currentX = new SimpleObjectProperty<X>(this, "currentX");
final X getCurrentX() { return currentX.get(); }
final void setCurrentX(X value) { currentX.set(value); }
final ObjectProperty<X> currentXProperty() { return currentX; }
And in XYChart you will wonder how to get the size of displayed Series List? There is a method
/**
* Computes the size of series linked list
* @return size of series linked list
*/
int getSeriesSize() {
return displayedSeries.size();
}
But again it is package protected.
So there is much more like that, so how should one extend XYChart to make a custom two axis chart diagramm with all that issues?
As I've seen some code is package protected but in the comment is the meaning the opposite. Like this one in XYChart.Data:
/**
* The current displayed data value plotted on the X axis. This may be the same as xValue or different. It is
* used by XYChart to animate the xValue from the old value to the new value. This is what you should plot
* in any custom XYChart implementations. Some XYChart chart implementations such as LineChart also use this
* to animate when data is added or removed.
*/
private ObjectProperty<X> currentX = new SimpleObjectProperty<X>(this, "currentX");
final X getCurrentX() { return currentX.get(); }
final void setCurrentX(X value) { currentX.set(value); }
final ObjectProperty<X> currentXProperty() { return currentX; }
And in XYChart you will wonder how to get the size of displayed Series List? There is a method
/**
* Computes the size of series linked list
* @return size of series linked list
*/
int getSeriesSize() {
return displayedSeries.size();
}
But again it is package protected.
So there is much more like that, so how should one extend XYChart to make a custom two axis chart diagramm with all that issues?