I’m generating a chart with 2 data series. The first with categories (about 30 different cotegories) as y values and the second without.
The problem is that the automatic built y axis for the second series is about ten times bigger then needed and so the relative line plot is too flat!
Setting the min and max value on the second y axis do not affect the rendered graph.
In the x axis there are date-time values.
The first serie contains categories as y values :
YAxis y1 = new YAxis();
Title title = new Title(c.getFieldName());
y1.setTitle(title);
conf.addyAxis(y1);
....
Labels labels = new Labels(true);
y1.setAllowDecimals(false);
List<String> collect = .... ;
y1.setCategories(collect.toArray(new String[] {}));
labels.setStep(1);
y1.setMin(0);
y1.setMax(collect.size()-1);
y1.setLabels(labels );
...
conf.addSeries(container);
container.setyAxis(y1);
The second serie yAxis settings :
YAxis y1 = new YAxis();
Title title = new Title(c.getFieldName());
y1.setTitle(title);
conf.addyAxis(y1);
...
y1.setMin((Number) yMin);
y1.setMax((Number) yMax);
...
conf.addSeries(container);
container.setyAxis(y1);
I’m using vaadin 7.4.3 and vaadin chart 1.1.6.
The problem is present also with 2.0.0 and with 2.1.0.rc1 version of vaadin chart
Same problem here. In my case I have to recalculate the tick interval based on min and max values so that I can get a set number of tickmarks. I always end up with more tickmarks than I need because the Y axis adds extras at top and bottom because of the extra space that it sets aside. I have set min and max, tried setting the same with setExtremes, setStartOnTick, setEndOnTick, setMaxPadding, setShowFirstLabel, setShowLastLabel. I have thrown everything I can find at it, but the Y axis, even with just ONE y axis, has a mind of its own.
I have seen forum posts as old as two years that complain about lack of control on the Y axis, with no answer.
Tankyou, yes your solution function!
I also found that the setMax and setMin are taken into account if you set the TickInterval of the y axis.
So another solution is set the tickInterval to an appropriate value.
Second this answer its not really true because if you set conf.getChart().setAlignTicks(false) in multiple Y chart axes , you going to see a wrong lines grids.
You need to set secondary Y axis grid line width to 0.