Ferdau
Ferdau

Reputation: 1558

Google Charts API labels with lines

Is it possible to achieve the same effect with the 'new' Google Charts API like in the deprecated Image Charts service where the labels are outside the chart and a line points to the right pie slice?

Important: I know how to create the pie chart, I just don't know how I can achieve the: labels outside the chart + lines layout.

How it should look (uses deprecated Image Charts):

enter image description here

EDIT: just to make sure you guys don't write down to much code, I am just searching for the right properties to achieve this. Thanks.

Upvotes: 3

Views: 4395

Answers (1)

vortexwolf
vortexwolf

Reputation: 14037

You can get a similar result by using the legend.position property and set its value to labeled.

Though the line points will be attached to the centers of the slices, it's not possible to reattach them to slice borders.

  var options = {
      legend: { position: 'labeled' }
  };

  // ...
  chart.draw(data, options);

The picture of the chart: Google pie chart with colored lines

Upvotes: 16

Related Questions