Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8092265

Provide mechanism to create custom XYChart subclass

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: 8u40
    • Fix Version/s: tbd
    • Component/s: javafx
    • Labels:
    • Environment:

      Windows 8.1 x64, Netbeans 8.0.2, JDK 8u40 b23

      Description

      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?

        Attachments

          Activity

            People

            • Assignee:
              aghaisas Ajit Ghaisas
              Reporter:
              andrejfx André (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported: