Java - Xeiam's XChart Marker With Values

668 views Asked by At

I've been trying to figure out if it is possible to put the exact value for each Bar/Line Marker.

Current Result : enter image description here

Desired Result : enter image description here

1

There are 1 answers

0
Dheeraj On

In Xchart library, to get the count of each bar use annotations.

CategoryChart chart = new CategoryChartBuilder()
            .yAxisTitle("ABC Title")
            .theme(Styler.ChartTheme.GGPlot2).build();

    //each stack count and total count of each bar
    chart.getStyler().setHasAnnotations(true);
    chart.getStyler().setShowTotalAnnotations(true);
    chart.getStyler().setAnnotationsPosition(1);