1 /*
   2  * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javafx.scene.chart;
  27 
  28 import java.util.*;
  29 
  30 import javafx.animation.FadeTransition;
  31 import javafx.animation.Interpolator;
  32 import javafx.animation.KeyFrame;
  33 import javafx.animation.KeyValue;
  34 import javafx.animation.Timeline;
  35 import javafx.application.Platform;
  36 import javafx.beans.NamedArg;
  37 import javafx.beans.property.DoubleProperty;
  38 import javafx.beans.property.SimpleDoubleProperty;
  39 import javafx.collections.FXCollections;
  40 import javafx.collections.ListChangeListener;
  41 import javafx.collections.ObservableList;
  42 import javafx.scene.AccessibleRole;
  43 import javafx.scene.Group;
  44 import javafx.scene.Node;
  45 import javafx.scene.layout.StackPane;
  46 import javafx.scene.shape.ClosePath;
  47 import javafx.scene.shape.LineTo;
  48 import javafx.scene.shape.MoveTo;
  49 import javafx.scene.shape.Path;
  50 import javafx.scene.shape.PathElement;
  51 import javafx.scene.shape.StrokeLineJoin;
  52 import javafx.util.Duration;
  53 
  54 import com.sun.javafx.charts.Legend;
  55 import com.sun.javafx.charts.Legend.LegendItem;
  56 import javafx.css.converter.BooleanConverter;
  57 import javafx.beans.property.BooleanProperty;
  58 import javafx.css.CssMetaData;
  59 import javafx.css.Styleable;
  60 import javafx.css.StyleableBooleanProperty;
  61 import javafx.css.StyleableProperty;
  62 
  63 /**
  64  * AreaChart - Plots the area between the line that connects the data points and
  65  * the 0 line on the Y axis.
  66  * @since JavaFX 2.0
  67  */
  68 public class AreaChart<X,Y> extends XYChart<X,Y> {
  69 
  70     // -------------- PRIVATE FIELDS ------------------------------------------
  71 
  72     /** A multiplier for teh Y values that we store for each series, it is used to animate in a new series */
  73     private Map<Series<X,Y>, DoubleProperty> seriesYMultiplierMap = new HashMap<>();
  74     private Legend legend = new Legend();
  75 
  76     // -------------- PUBLIC PROPERTIES ----------------------------------------
  77 
  78     /**
  79      * When true, CSS styleable symbols are created for any data items that don't have a symbol node specified.
  80      * @since JavaFX 8.0
  81      */
  82     private BooleanProperty createSymbols = new StyleableBooleanProperty(true) {
  83         @Override protected void invalidated() {
  84             for (int seriesIndex=0; seriesIndex < getData().size(); seriesIndex ++) {
  85                 Series<X,Y> series = getData().get(seriesIndex);
  86                 for (int itemIndex=0; itemIndex < series.getData().size(); itemIndex ++) {
  87                     Data<X,Y> item = series.getData().get(itemIndex);
  88                     Node symbol = item.getNode();
  89                     if(get() && symbol == null) { // create any symbols
  90                         symbol = createSymbol(series, getData().indexOf(series), item, itemIndex);
  91                         if (null != symbol) {
  92                             getPlotChildren().add(symbol);
  93                         }
  94                     } else if (!get() && symbol != null) { // remove symbols
  95                         getPlotChildren().remove(symbol);
  96                         symbol = null;
  97                         item.setNode(null);
  98                     }
  99                 }
 100             }
 101             requestChartLayout();
 102         }
 103 
 104         public Object getBean() {
 105             return this;
 106         }
 107 
 108         public String getName() {
 109             return "createSymbols";
 110         }
 111 
 112         public CssMetaData<AreaChart<?, ?>,Boolean> getCssMetaData() {
 113             return StyleableProperties.CREATE_SYMBOLS;
 114         }
 115     };
 116 
 117     /**
 118      * Indicates whether symbols for data points will be created or not.
 119      *
 120      * @return true if symbols for data points will be created and false otherwise.
 121      * @since JavaFX 8.0
 122      */
 123     public final boolean getCreateSymbols() { return createSymbols.getValue(); }
 124     public final void setCreateSymbols(boolean value) { createSymbols.setValue(value); }
 125     public final BooleanProperty createSymbolsProperty() { return createSymbols; }
 126 
 127 
 128     // -------------- CONSTRUCTORS ----------------------------------------------
 129 
 130     /**
 131      * Construct a new Area Chart with the given axis
 132      *
 133      * @param xAxis The x axis to use
 134      * @param yAxis The y axis to use
 135      */
 136     public AreaChart(@NamedArg("xAxis") Axis<X> xAxis, @NamedArg("yAxis") Axis<Y> yAxis) {
 137         this(xAxis,yAxis, FXCollections.<Series<X,Y>>observableArrayList());
 138     }
 139 
 140     /**
 141      * Construct a new Area Chart with the given axis and data
 142      *
 143      * @param xAxis The x axis to use
 144      * @param yAxis The y axis to use
 145      * @param data The data to use, this is the actual list used so any changes to it will be reflected in the chart
 146      */
 147     public AreaChart(@NamedArg("xAxis") Axis<X> xAxis, @NamedArg("yAxis") Axis<Y> yAxis, @NamedArg("data") ObservableList<Series<X,Y>> data) {
 148         super(xAxis,yAxis);
 149         setLegend(legend);
 150         setData(data);
 151     }
 152 
 153     // -------------- METHODS ------------------------------------------------------------------------------------------
 154 
 155     private static double doubleValue(Number number) { return doubleValue(number, 0); }
 156     private static double doubleValue(Number number, double nullDefault) {
 157         return (number == null) ? nullDefault : number.doubleValue();
 158     }
 159 
 160        /** @inheritDoc */
 161     @Override protected void updateAxisRange() {
 162         final Axis<X> xa = getXAxis();
 163         final Axis<Y> ya = getYAxis();
 164         List<X> xData = null;
 165         List<Y> yData = null;
 166         if(xa.isAutoRanging()) xData = new ArrayList<X>();
 167         if(ya.isAutoRanging()) yData = new ArrayList<Y>();
 168         if(xData != null || yData != null) {
 169             for(Series<X,Y> series : getData()) {
 170                 for(Data<X,Y> data: series.getData()) {
 171                     if(xData != null) xData.add(data.getXValue());
 172                     if(yData != null) yData.add(data.getYValue());
 173                 }
 174             }
 175             if(xData != null && !(xData.size() == 1 && getXAxis().toNumericValue(xData.get(0)) == 0)) {
 176                 xa.invalidateRange(xData);
 177             }
 178             if(yData != null && !(yData.size() == 1 && getYAxis().toNumericValue(yData.get(0)) == 0)) {
 179                 ya.invalidateRange(yData);
 180             }
 181         }
 182     }
 183 
 184     @Override protected void dataItemAdded(Series<X,Y> series, int itemIndex, Data<X,Y> item) {
 185         final Node symbol = createSymbol(series, getData().indexOf(series), item, itemIndex);
 186         if (shouldAnimate()) {
 187             boolean animate = false;
 188             if (itemIndex > 0 && itemIndex < (series.getData().size()-1)) {
 189                 animate = true;
 190                 Data<X,Y> p1 = series.getData().get(itemIndex - 1);
 191                 Data<X,Y> p2 = series.getData().get(itemIndex + 1);
 192                 double x1 = getXAxis().toNumericValue(p1.getXValue());
 193                 double y1 = getYAxis().toNumericValue(p1.getYValue());
 194                 double x3 = getXAxis().toNumericValue(p2.getXValue());
 195                 double y3 = getYAxis().toNumericValue(p2.getYValue());
 196 
 197                 double x2 = getXAxis().toNumericValue(item.getXValue());
 198                 double y2 = getYAxis().toNumericValue(item.getYValue());
 199 
 200 //                //1. y intercept of the line : y = ((y3-y1)/(x3-x1)) * x2 + (x3y1 - y3x1)/(x3 -x1)
 201                 double y = ((y3-y1)/(x3-x1)) * x2 + (x3*y1 - y3*x1)/(x3-x1);
 202                 item.setCurrentY(getYAxis().toRealValue(y));
 203                 item.setCurrentX(getXAxis().toRealValue(x2));
 204                 //2. we can simply use the midpoint on the line as well..
 205 //                double x = (x3 + x1)/2;
 206 //                double y = (y3 + y1)/2;
 207 //                item.setCurrentX(x);
 208 //                item.setCurrentY(y);
 209             } else if (itemIndex == 0 && series.getData().size() > 1) {
 210                 animate = true;
 211                 item.setCurrentX(series.getData().get(1).getXValue());
 212                 item.setCurrentY(series.getData().get(1).getYValue());
 213             } else if (itemIndex == (series.getData().size() - 1) && series.getData().size() > 1) {
 214                 animate = true;
 215                 int last = series.getData().size() - 2;
 216                 item.setCurrentX(series.getData().get(last).getXValue());
 217                 item.setCurrentY(series.getData().get(last).getYValue());
 218             }
 219             if (symbol != null) {
 220                 // fade in new symbol
 221                 symbol.setOpacity(0);
 222                 getPlotChildren().add(symbol);
 223                 FadeTransition ft = new FadeTransition(Duration.millis(500),symbol);
 224                 ft.setToValue(1);
 225                 ft.play();
 226             }
 227             if (animate) {
 228                 animate(
 229                     new KeyFrame(Duration.ZERO,
 230                             (e) -> {
 231                                 if (symbol != null && !getPlotChildren().contains(symbol)) {
 232                                     getPlotChildren().add(symbol);
 233                                 } },
 234                             new KeyValue(item.currentYProperty(),
 235                                     item.getCurrentY()),
 236                             new KeyValue(item.currentXProperty(),
 237                                     item.getCurrentX())
 238                     ),
 239                     new KeyFrame(Duration.millis(800), new KeyValue(item.currentYProperty(),
 240                                         item.getYValue(), Interpolator.EASE_BOTH),
 241                                         new KeyValue(item.currentXProperty(),
 242                                         item.getXValue(), Interpolator.EASE_BOTH))
 243                 );
 244             }
 245 
 246         } else if (symbol != null) {
 247             getPlotChildren().add(symbol);
 248         }
 249     }
 250 
 251     @Override protected  void dataItemRemoved(final Data<X,Y> item, final Series<X,Y> series) {
 252         final Node symbol = item.getNode();
 253 
 254         if (symbol != null) {
 255             symbol.focusTraversableProperty().unbind();
 256         }
 257 
 258         // remove item from sorted list
 259         int itemIndex = series.getItemIndex(item);
 260         if (shouldAnimate()) {
 261             boolean animate = false;
 262             // dataSize represents size of currently visible data. After this operation, the number will decrement by 1
 263             final int dataSize = series.getDataSize();
 264             // This is the size of current data list in Series. Note that it might be totaly different from dataSize as
 265             // some big operation might have happened on the list.
 266             final int dataListSize = series.getData().size();
 267             if (itemIndex > 0 && itemIndex < dataSize -1) {
 268                 animate = true;
 269                 Data<X,Y> p1 = series.getItem(itemIndex - 1);
 270                 Data<X,Y> p2 = series.getItem(itemIndex + 1);
 271                 double x1 = getXAxis().toNumericValue(p1.getXValue());
 272                 double y1 = getYAxis().toNumericValue(p1.getYValue());
 273                 double x3 = getXAxis().toNumericValue(p2.getXValue());
 274                 double y3 = getYAxis().toNumericValue(p2.getYValue());
 275 
 276                 double x2 = getXAxis().toNumericValue(item.getXValue());
 277                 double y2 = getYAxis().toNumericValue(item.getYValue());
 278 
 279 //                //1.  y intercept of the line : y = ((y3-y1)/(x3-x1)) * x2 + (x3y1 - y3x1)/(x3 -x1)
 280                 double y = ((y3-y1)/(x3-x1)) * x2 + (x3*y1 - y3*x1)/(x3-x1);
 281                 item.setCurrentX(getXAxis().toRealValue(x2));
 282                 item.setCurrentY(getYAxis().toRealValue(y2));
 283                 item.setXValue(getXAxis().toRealValue(x2));
 284                 item.setYValue(getYAxis().toRealValue(y));
 285                 //2.  we can simply use the midpoint on the line as well..
 286 //                double x = (x3 + x1)/2;
 287 //                double y = (y3 + y1)/2;
 288 //                item.setCurrentX(x);
 289 //                item.setCurrentY(y);
 290             } else {
 291                 if (itemIndex == 0 && dataListSize > 1) {
 292                     animate = true;
 293                     item.setXValue(series.getData().get(0).getXValue());
 294                     item.setYValue(series.getData().get(0).getYValue());
 295                 } else if (itemIndex == (dataSize - 1) && dataListSize > 1) {
 296                     animate = true;
 297                     int last = dataListSize - 1;
 298                     item.setXValue(series.getData().get(last).getXValue());
 299                     item.setYValue(series.getData().get(last).getYValue());
 300                 } else if (symbol != null) {
 301                     // fade out symbol
 302                     symbol.setOpacity(0);
 303                     FadeTransition ft = new FadeTransition(Duration.millis(500),symbol);
 304                     ft.setToValue(0);
 305                     ft.setOnFinished(actionEvent -> {
 306                         getPlotChildren().remove(symbol);
 307                         removeDataItemFromDisplay(series, item);
 308                     });
 309                     ft.play();
 310                 }
 311             }
 312             if (animate) {
 313                 animate( new KeyFrame(Duration.ZERO, new KeyValue(item.currentYProperty(),
 314                             item.getCurrentY()), new KeyValue(item.currentXProperty(),
 315                             item.getCurrentX())),
 316                             new KeyFrame(Duration.millis(800), actionEvent -> {
 317                                 item.setSeries(null);
 318                                 getPlotChildren().remove(symbol);
 319                                 removeDataItemFromDisplay(series, item);
 320                             },
 321                             new KeyValue(item.currentYProperty(),
 322                             item.getYValue(), Interpolator.EASE_BOTH),
 323                             new KeyValue(item.currentXProperty(),
 324                             item.getXValue(), Interpolator.EASE_BOTH))
 325                 );
 326             }
 327         } else {
 328             item.setSeries(null);
 329             getPlotChildren().remove(symbol);
 330             removeDataItemFromDisplay(series, item);
 331         }
 332         //Note: better animation here, point should move from old position to new position at center point between prev and next symbols
 333     }
 334 
 335     /** @inheritDoc */
 336     @Override protected void dataItemChanged(Data<X, Y> item) {
 337     }
 338 
 339     @Override protected void seriesChanged(ListChangeListener.Change<? extends Series> c) {
 340         // Update style classes for all series lines and symbols
 341         // Note: is there a more efficient way of doing this?
 342         for (int i = 0; i < getDataSize(); i++) {
 343             final Series<X,Y> s = getData().get(i);
 344             Path seriesLine = (Path)((Group)s.getNode()).getChildren().get(1);
 345             Path fillPath = (Path)((Group)s.getNode()).getChildren().get(0);
 346             seriesLine.getStyleClass().setAll("chart-series-area-line", "series" + i, s.defaultColorStyleClass);
 347             fillPath.getStyleClass().setAll("chart-series-area-fill", "series" + i, s.defaultColorStyleClass);
 348             for (int j=0; j < s.getData().size(); j++) {
 349                 final Data<X,Y> item = s.getData().get(j);
 350                 final Node node = item.getNode();
 351                 if(node!=null) node.getStyleClass().setAll("chart-area-symbol", "series" + i, "data" + j, s.defaultColorStyleClass);
 352             }
 353         }
 354     }
 355 
 356     @Override protected  void seriesAdded(Series<X,Y> series, int seriesIndex) {
 357         // create new paths for series
 358         Path seriesLine = new Path();
 359         Path fillPath = new Path();
 360         seriesLine.setStrokeLineJoin(StrokeLineJoin.BEVEL);
 361         Group areaGroup = new Group(fillPath,seriesLine);
 362         series.setNode(areaGroup);
 363         // create series Y multiplier
 364         DoubleProperty seriesYAnimMultiplier = new SimpleDoubleProperty(this, "seriesYMultiplier");
 365         seriesYMultiplierMap.put(series, seriesYAnimMultiplier);
 366         // handle any data already in series
 367         if (shouldAnimate()) {
 368             seriesYAnimMultiplier.setValue(0d);
 369         } else {
 370             seriesYAnimMultiplier.setValue(1d);
 371         }
 372         getPlotChildren().add(areaGroup);
 373         List<KeyFrame> keyFrames = new ArrayList<KeyFrame>();
 374         if (shouldAnimate()) {
 375             // animate in new series
 376             keyFrames.add(new KeyFrame(Duration.ZERO,
 377                 new KeyValue(areaGroup.opacityProperty(), 0),
 378                 new KeyValue(seriesYAnimMultiplier, 0)
 379             ));
 380             keyFrames.add(new KeyFrame(Duration.millis(200),
 381                new KeyValue(areaGroup.opacityProperty(), 1)
 382             ));
 383             keyFrames.add(new KeyFrame(Duration.millis(500),
 384                 new KeyValue(seriesYAnimMultiplier, 1)
 385             ));
 386         }
 387         for (int j=0; j<series.getData().size(); j++) {
 388             Data<X,Y> item = series.getData().get(j);
 389             final Node symbol = createSymbol(series, seriesIndex, item, j);
 390             if (symbol != null) {
 391                 if (shouldAnimate()) {
 392                     symbol.setOpacity(0);
 393                     getPlotChildren().add(symbol);
 394                     // fade in new symbol
 395                     keyFrames.add(new KeyFrame(Duration.ZERO, new KeyValue(symbol.opacityProperty(), 0)));
 396                     keyFrames.add(new KeyFrame(Duration.millis(200), new KeyValue(symbol.opacityProperty(), 1)));
 397                 }
 398                 else {
 399                     getPlotChildren().add(symbol);
 400                 }
 401             }
 402         }
 403         if (shouldAnimate()) animate(keyFrames.toArray(new KeyFrame[keyFrames.size()]));
 404     }
 405 
 406     @Override protected  void seriesRemoved(final Series<X,Y> series) {
 407         // remove series Y multiplier
 408         seriesYMultiplierMap.remove(series);
 409         // remove all symbol nodes
 410         if (shouldAnimate()) {
 411             Timeline tl = new Timeline(createSeriesRemoveTimeLine(series, 400));
 412             tl.play();
 413         } else {
 414             getPlotChildren().remove(series.getNode());
 415             for (Data<X,Y> d:series.getData()) getPlotChildren().remove(d.getNode());
 416             removeSeriesFromDisplay(series);
 417         }
 418     }
 419 
 420     /** @inheritDoc */
 421     @Override protected void layoutPlotChildren() {
 422         List<LineTo> constructedPath = new ArrayList<>(getDataSize());
 423         for (int seriesIndex=0; seriesIndex < getDataSize(); seriesIndex++) {
 424             Series<X, Y> series = getData().get(seriesIndex);
 425             DoubleProperty seriesYAnimMultiplier = seriesYMultiplierMap.get(series);
 426             double lastX = 0;
 427             final ObservableList<Node> children = ((Group) series.getNode()).getChildren();
 428             ObservableList<PathElement> seriesLine = ((Path) children.get(1)).getElements();
 429             ObservableList<PathElement> fillPath = ((Path) children.get(0)).getElements();
 430             seriesLine.clear();
 431             fillPath.clear();
 432             constructedPath.clear();
 433             for (Iterator<Data<X, Y>> it = getDisplayedDataIterator(series); it.hasNext(); ) {
 434                 Data<X, Y> item = it.next();
 435                 double x = getXAxis().getDisplayPosition(item.getCurrentX());
 436                 double y = getYAxis().getDisplayPosition(
 437                         getYAxis().toRealValue(getYAxis().toNumericValue(item.getCurrentY()) * seriesYAnimMultiplier.getValue()));
 438                 constructedPath.add(new LineTo(x, y));
 439                 if (Double.isNaN(x) || Double.isNaN(y)) {
 440                     continue;
 441                 }
 442                 lastX = x;
 443                 Node symbol = item.getNode();
 444                 if (symbol != null) {
 445                     final double w = symbol.prefWidth(-1);
 446                     final double h = symbol.prefHeight(-1);
 447                     symbol.resizeRelocate(x-(w/2), y-(h/2),w,h);
 448                 }
 449             }
 450 
 451             if (!constructedPath.isEmpty()) {
 452                 Collections.sort(constructedPath, (e1, e2) -> Double.compare(e1.getX(), e2.getX()));
 453                 LineTo first = constructedPath.get(0);
 454 
 455                 final double displayYPos = first.getY();
 456                 final double numericYPos = getYAxis().toNumericValue(getYAxis().getValueForDisplay(displayYPos));
 457 
 458                 // RT-34626: We can't always use getZeroPosition(), as it may be the case
 459                 // that the zero position of the y-axis is not visible on the chart. In these
 460                 // cases, we need to use the height between the point and the y-axis line.
 461                 final double yAxisZeroPos = getYAxis().getZeroPosition();
 462                 final boolean isYAxisZeroPosVisible = !Double.isNaN(yAxisZeroPos);
 463                 final double yAxisHeight = getYAxis().getHeight();
 464                 final double yFillPos = isYAxisZeroPosVisible ? yAxisZeroPos :
 465                                         numericYPos < 0 ? numericYPos - yAxisHeight : yAxisHeight;
 466 
 467                 seriesLine.add(new MoveTo(first.getX(), displayYPos));
 468                 fillPath.add(new MoveTo(first.getX(), yFillPos));
 469 
 470                 seriesLine.addAll(constructedPath);
 471                 fillPath.addAll(constructedPath);
 472                 fillPath.add(new LineTo(lastX, yFillPos));
 473                 fillPath.add(new ClosePath());
 474             }
 475         }
 476     }
 477 
 478     private Node createSymbol(Series<X,Y> series, int seriesIndex, final Data<X,Y> item, int itemIndex) {
 479         Node symbol = item.getNode();
 480         // check if symbol has already been created
 481         if (symbol == null && getCreateSymbols()) {
 482             symbol = new StackPane();
 483             symbol.setAccessibleRole(AccessibleRole.TEXT);
 484             symbol.setAccessibleRoleDescription("Point");
 485             symbol.focusTraversableProperty().bind(Platform.accessibilityActiveProperty());
 486             item.setNode(symbol);
 487         }
 488         // set symbol styles
 489         // Note: not sure if we want to add or check, ie be more careful and efficient here
 490         if (symbol != null) symbol.getStyleClass().setAll("chart-area-symbol", "series" + seriesIndex, "data" + itemIndex,
 491                 series.defaultColorStyleClass);
 492         return symbol;
 493     }
 494 
 495     /**
 496      * This is called whenever a series is added or removed and the legend needs to be updated
 497      */
 498     @Override protected void updateLegend() {
 499         legend.getItems().clear();
 500         if (getData() != null) {
 501             for (int seriesIndex=0; seriesIndex < getData().size(); seriesIndex++) {
 502                 Series<X,Y> series = getData().get(seriesIndex);
 503                 LegendItem legenditem = new LegendItem(series.getName());
 504                 legenditem.getSymbol().getStyleClass().addAll("chart-area-symbol","series"+seriesIndex,
 505                         "area-legend-symbol", series.defaultColorStyleClass);
 506                 legend.getItems().add(legenditem);
 507             }
 508         }
 509         if (legend.getItems().size() > 0) {
 510             if (getLegend() == null) {
 511                 setLegend(legend);
 512             }
 513         } else {
 514             setLegend(null);
 515         }
 516     }
 517 
 518     // -------------- STYLESHEET HANDLING --------------------------------------
 519 
 520     private static class StyleableProperties {
 521         private static final CssMetaData<AreaChart<?,?>,Boolean> CREATE_SYMBOLS =
 522             new CssMetaData<AreaChart<?,?>,Boolean>("-fx-create-symbols",
 523                 BooleanConverter.getInstance(), Boolean.TRUE) {
 524 
 525             @Override
 526             public boolean isSettable(AreaChart<?,?> node) {
 527                 return node.createSymbols == null || !node.createSymbols.isBound();
 528 }
 529 
 530             @Override
 531             public StyleableProperty<Boolean> getStyleableProperty(AreaChart<?,?> node) {
 532                 return (StyleableProperty<Boolean>)node.createSymbolsProperty();
 533             }
 534         };
 535 
 536         private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES;
 537         static {
 538             final List<CssMetaData<? extends Styleable, ?>> styleables =
 539                 new ArrayList<CssMetaData<? extends Styleable, ?>>(XYChart.getClassCssMetaData());
 540             styleables.add(CREATE_SYMBOLS);
 541             STYLEABLES = Collections.unmodifiableList(styleables);
 542         }
 543     }
 544 
 545     /**
 546      * @return The CssMetaData associated with this class, which may include the
 547      * CssMetaData of its super classes.
 548      * @since JavaFX 8.0
 549      */
 550     public static List<CssMetaData<? extends Styleable, ?>> getClassCssMetaData() {
 551         return StyleableProperties.STYLEABLES;
 552     }
 553 
 554     /**
 555      * {@inheritDoc}
 556      * @since JavaFX 8.0
 557      */
 558     @Override
 559     public List<CssMetaData<? extends Styleable, ?>> getCssMetaData() {
 560         return getClassCssMetaData();
 561     }
 562 
 563 }