Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

using setXAxisMaxLabelCount against a HeatMapChart alters both axes #564

Closed
mccartney opened this issue Feb 5, 2021 · 0 comments · Fixed by #565
Closed

using setXAxisMaxLabelCount against a HeatMapChart alters both axes #564

mccartney opened this issue Feb 5, 2021 · 0 comments · Fixed by #565

Comments

@mccartney
Copy link
Collaborator

One would expect setXAxisMaxLabelCount() only alters the number of labels of the X axis and doesn't affect the number for Y axis.
Yet in HeatMapCharts that's not true.

e.g.

        int N = 12;
        java.util.List<Integer> xData = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
        java.util.List<String> yData =
                Arrays.asList("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
        java.util.List<Number[]> data = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                data.add(new Integer[]{i, j, (i * 2 + j * 3) % 7});
            }
        }

        HeatMapChart chart = new HeatMapChart(800, 600);
        chart.addSeries("only", xData, yData, data);
        chart.getStyler().setTheme(new XChartTheme());
        chart.getStyler().setXAxisMaxLabelCount(5); // <---------------- they key line!
        BitmapEncoder.saveBitmap(chart, "/tmp/chart.png", BitmapEncoder.BitmapFormat.PNG);

yields
chart

@mccartney mccartney changed the title using setXAxisMaxLabelCount against a HeatMapChart alters boths axes using setXAxisMaxLabelCount against a HeatMapChart alters both axes Feb 5, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant