Let me begin by giving you an idea of what kind of chart I'm trying to make. This would be ideal:
Oz0GqUn.png
I've spent hours trying to solve this problem without any luck. I'm pretty sure that it's impossible to draw series like in the image above, where the X values are not always ascending. I can work around this by splitting the polygon in half and having two series for each side.
The main problem I'm having is that the chart just ignores my X values. For example, if I try to draw a line from (40, 1300) to (50, 1300), the line will begin at the edge and end on the other side, instead of drawing a line between X values of 40 and 50 with gaps at the side. I'm basically getting this:
kxABsRI.png
The chart is ignoring the X part of my data and it's only drawing the Y values in succession. If I put NaN values before and after my actual values, I get this:
bJrsCvi.png
Since I now have 4 values (2 empty and 2 actual), the X axis (bottom) is simply divided into 4 parts and the X values are completely ignored (the line should only be between 40 and 50).
So my question is how can I force the chart to draw the lines from actual XY values instead of automatically dividing the graph evenly by the number of values I have?
My code is as follows:
Code:
// Code for both axis:
chartYaxis = new NumericAxis<ChartData>();
chartYaxis.setPosition(Position.LEFT);
chartYaxis.setDisplayGrid(true);
chartYaxis.addField(chartDataProps.yVal());
chartYaxis.setMinimum(1000.0);
chartYaxis.setMaximum(1700.0);
chartYaxis.setInterval(100.0);
chartXaxis = new NumericAxis<ChartData>();
chartXaxis.setPosition(Position.BOTTOM);
chartXaxis.setDisplayGrid(true);
chartXaxis.addField(chartDataProps.xVal());
chartXaxis.setMinimum(30.0);
chartXaxis.setMaximum(65);
chartXaxis.setInterval(5.0);
// Code for data series:
LineSeries<ChartData> series1 = new LineSeries<ChartData>();
series1 .setYAxisPosition(Position.LEFT);
series1 .setYField(chartDataProps.yVal());
envelope1Series.setGapless(true);
// Code for creating chart:
wbChart = new Chart<ChartData>();
wbChart.setStore(chartStore);
wbChart.addAxis(chartYaxis);
wbChart.addAxis(chartXaxis);
wbChart.addSeries(series1 );
wbChart.setDefaultInsets(10);
As you can see, I set both min/max intervals. I was expecting that anything I plot will be scaled accordingly, not divided in equal parts.
I don't know what else to try, I've been trying to crack this for days now and it's starting to get really silly. I would really appreciate any kind of advice.