1

I wish to have a graph similar to this chart. I'm able achieve it partially, but I'm not able to get that centre count part. How to achieve the same? Do I need to use SOLIDGAUGE or PIE as ChartType?

Currently I'm using ChartType as PIE. And to achieve the hollow part in centre, I'm writing below code. what I've achieved

PlotOptionsPie plotOptions=new PlotOptionsPie();
plotOptions.setInnerSize("50%");
configuration.setPlotOptions(plotOptions);

But now how to put that count (985 as in image) in centre? I tried using DataLabels but its not working.

Note: I'm using Vaadin Charts 3.2.1, Vaadin 7 and Java 8

Shaini Sinha
  • 527
  • 6
  • 10

1 Answers1

1

Pie chart with inner size is the way to go.

You can use the title for that purpose, and set the location of the title in the middle of the chart.

    Configuration conf = chart.getConfiguration();
    Title title = conf.getTitle();
    title.setText("985");
    title.setAlign(HorizontalAlign.CENTER);
    title.setVerticalAlign(VerticalAlign.MIDDLE);

Hope this helps

Guille
  • 449
  • 3
  • 6
  • I'm already using Title to set the title of the chart. Here [what I've achieved](https://ibb.co/eEUgQ9) you can find I've already defined the value as 'Status Chart' as heading for that. – Shaini Sinha Aug 30 '18 at 08:39
  • @ShainiSinha Can you share the full code you're using? In this example, there is both vertical and horizontal alignment. – eeq Aug 30 '18 at 09:48
  • @eeq The problem with the above suggested code is that I'm already using conf.setTitle("Status Chart") to set the title of my chart. – Shaini Sinha Aug 30 '18 at 11:00
  • can you use the subtitle for the "Status Chart" text? – Guille Sep 24 '18 at 14:45