2

Why doesn't AreaChart cover all the area below the line?

Here's the fxml code for my chart (it's really basic):

<AreaChart fx:id="CWTareaLayerChart" prefHeight="547.0" prefWidth="682.0" GridPane.rowIndex="1">
    <xAxis>
        <NumberAxis side="BOTTOM" fx:id="xAxisCWT" />
    </xAxis>
    <yAxis>
        <NumberAxis fx:id="yAxisCWT" side="LEFT" />
    </yAxis>
</AreaChart>

I define the axis in Java Controller with @FXML tag.

The initialization part (this method is called from public void initialize(URL location, ResourceBundle resources) :

private void initializeLayerChart() {
    xAxisCWT.setForceZeroInRange(false);
    yAxisCWT.setForceZeroInRange(true);

    xAxisCWT.setAutoRanging(true);
    yAxisCWT.setAutoRanging(true);

    yAxisCWT.setLowerBound(-5.0);

    xAxisCWT.setLabel("W (%)");
    yAxisCWT.setLabel("avg C (pF)");
}

There's also a Refresh button which refreshes the content of series (there can be one or more series) and re-draws the chart. The method itselfs returns List < XYChart.Series > and series contain Double values; then the series are added to chart:

this.CWTareaLayerChart.getData().addAll(allSeries);

As the result I obtain something like this:

Two series on AreaChart

or this:

One serie on AreaChart

I've tried different combinations of true/false in setAutoRanging() and setForceZeroInRange(), also played with setLowerBound(), but the result is always something like on the images - the last points of series are shown but the area below isn't colored.

Mike Zavarello
  • 3,514
  • 4
  • 29
  • 43
  • I tried to reproduce your problem, but I can't. Maybe your plot point data is the problem. How do you get the data for the plot points? – PalinDrome555 Aug 15 '17 at 15:46

1 Answers1

0

Did you tried to set the threshold parameter?

API Reference:
http://api.highcharts.com/highcharts/plotOptions.series.threshold

Example:
http://jsfiddle.net/w5f3Ltcu/

pawel_d
  • 3,061
  • 1
  • 8
  • 13
  • I'm not using highcharts library (which is used for javascript applications, if I googled it right) but javaFX. I suppose the alternative for your threshold parameter is exactly `setLowerBound()` function so yes, I tried it. – Liavona Zh. Aug 03 '17 at 09:13