Setting the attribute 'minorTickInterval' other then 'auto' causes incorrect rendering of the minor ticks. Sometimes only the first minor tick is rendered sometimes non is rendered.
The following code demonstrates the problem:
import com.vaadin.addon.charts.Chart;
import com.vaadin.addon.charts.examples.AbstractVaadinChartExample;
import com.vaadin.addon.charts.model.ChartType;
import com.vaadin.addon.charts.model.Configuration;
import com.vaadin.addon.charts.model.ListSeries;
import com.vaadin.addon.charts.model.XAxis;
import com.vaadin.ui.Component;
public class BasicLine extends AbstractVaadinChartExample {
@Override
public String getDescription() {
return "Basic Line With Data Labels";
}
@Override
protected Component getChart() {
final Chart chart = new Chart();
chart.setHeight("450px");
chart.setWidth("100%");
final Configuration configuration = chart.getConfiguration();
configuration.setTitle("MinorTickInterval");
configuration.getChart().setType(ChartType.SPLINE);
final ListSeries series = new ListSeries(29.9, 71.5, 106.4, 129.2,
144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4);
configuration.setSeries(series);
XAxis xAxis = configuration.getxAxis();
xAxis.setTickInterval(1);
xAxis.setMinorTickInterval("0.2");
xAxis.setMinorTickWidth(1);
chart.drawChart(configuration);
return chart;
}
}
The source of this problem is that the numerical values are serialized in JSON as strings:
"minorTickInterval": "0.2"
If they were serialized as numbers then the chart would be rendered correctly:
Originally by stanik
Setting the attribute 'minorTickInterval' other then 'auto' causes incorrect rendering of the minor ticks. Sometimes only the first minor tick is rendered sometimes non is rendered.
The following code demonstrates the problem:
The source of this problem is that the numerical values are serialized in JSON as strings:
If they were serialized as numbers then the chart would be rendered correctly:
Imported from https://dev.vaadin.com/ issue #20163