amcharts3 icon indicating copy to clipboard operation
amcharts3 copied to clipboard

Errors when using negative values ​​in ​​pie-chart

Open frolant opened this issue 6 years ago • 1 comments

This error occurs if you specify a negative number that is greater in modulus than the sum of all positive values ​​of other parts in pie-chart.

For example:

'dataProvider'  : [
    {
      'title': 'category 1',
      'value': -35
    },
    {
      'title': 'category 2',
      'value': 10
    },
    {
      'title': 'category 3',
      'value': 20
    }
  ]

Pie-chart with such this data will not be displayed correctly, because: 35 > ( 10+20 )

If you correct value -35 in example on -30 or less, the data will be displayed correctly, because: 30 <= ( 10+20 )

frolant avatar Sep 08 '17 11:09 frolant

Negative values on a Pie chart do not make sense, hence all the unpredictable anomalies. How you depict a negative part of something?

I strongly suggest you include only absolute values.

You can include any additional values and reference to them in balloonText via meta code if you need to show a negative value. I.e.:

'dataProvider'  : [
    {
      'title': 'category 1',
      'value': -35,
      'realValue': -35
    },
    {
      'title': 'category 2',
      'value': 10,
      'realValue': 10
    },
    {
      'title': 'category 3',
      'value': 20,
      'realValue': 10
    }
  ]

I hope that makes sense.

martynasma avatar Sep 08 '17 11:09 martynasma