Black Lives Matter. Please consider donating to Black Girls Code today.

Can't define separators for Pie Chart

Hi,

I am trying to set regional decimal and grouping delimiters for various charts. For line and bar charts setting the “separators” value on layout works fine. But it does not seem to have any effect on a pie chart. Is this possible?

Example:

 <div id="graph"></div> 
 <script>
var chartData = [{
  values: [27.3454,12345.77],
  labels: ['a', 'b'],
  type: 'pie'
}];
var layout = {
  height: 300,
  width: 300  ,
  separators: ', '
};

Plotly.newPlot('graph', chartData, layout, {
  displayModeBar: false
});
   </script>

Thanks for bringing this up. This is definitely a bug. Subscribe to https://github.com/plotly/plotly.js/issues/512 for the latest development info.

In the meantime, you can use trace text in combination with textinfo to show 12 000,00 formatted numbers on your pie charts.

Thanks Etienne.

We like to show only the percentage in the segments, which is calculated based on which traces are enabled. However, following your example I managed to set up the following, which is close to what we want. Only percentage showing the wrong delimiter is better than having wrong delimiters in the value as well…

Plotly.plot('graph', [{
  type: 'pie',
  labels: ['apples', 'bananas', 'clementines'],
  values: [20.3, 40, 0],
  text: ['20,3', 40, null],
  textinfo: 'percent',
  hoverinfo: 'label+text+percent'
}])