highcharts / highcharts-editor

https://www.highcharts.com/products/highcharts-editor
Other
250 stars 96 forks source link

Strange behaviour of DataLabel.Format #98

Open berdeter opened 7 years ago

berdeter commented 7 years ago

Create a simple Pie Chart from sample data (single data column with categories)

You can see X is browser name and y is poucentages capture

Select Pie with legend as template capture2

Activate value labels (great but it shows X that you already have in the legend. You want Y) capture3

In advanced mode you see that it is configured to show y (but you see X) capture4

Put an {x} : you lose all labels Put a {y} : you see the Y !!! capture5

Good luck fixing this one. Thanks for all

PS : why are some values shadowed, not all ? Great question ...

cvasseng commented 7 years ago

Thanks for reporting! We'll look into this.

About the shadows, I couldn't say, will look into that too.

TorsteinHonsi commented 7 years ago

why are some values shadowed, not all ? Great question ...

Probably the default dataLabels.formatter overrides the format. Also, the pie slices don't have an x value. What you see is {name}.

The black label has a white outline, you just don't see it on the white background. This label color is determined to give max contrast to the slice itself, however this wouldn't be necessary in this case.

berdeter commented 7 years ago

I've done new tests in this area its more and more surprising.

First I've tricked the sample data so that column 2 is not actually percentages but amounts

capture

Then I adjusted the format to display several fields and the result is quite strange :

capture2

name : not displayed ? x : not displayed but ok it's not relevant y : does display something that seems to actually be a percentage in my data but it is not easy to confirm because the graph does not show names percentage : displays a value that looks like the percentage shown on the graph but has nothing to do with actual percentages (no data is around 53% of the total the graph itself show data coming from the same kind of fantasy as the percentage but has no link with the data

Yet another screenshot with data and pie beside each other ...

capture3

berdeter commented 7 years ago

Yet another sample with the same data that locates the problem more in the area of CSV data import :

image

TorsteinHonsi commented 7 years ago

The values look correct in Highcharts, except we need to use {point.name}: http://jsfiddle.net/highcharts/rasudxy1/

Also, some number formatting helps readability: http://jsfiddle.net/highcharts/rasudxy1/1/

berdeter commented 7 years ago

Thank you for the help.

So I there are 3 problems remaining around the editor :

Additionally I don't really undersandwhen you need to perfix by "point." (here you had to do iy for {point.name} but not for{y} and {percentage} but that must be a documentation issue.

Well anyway I can do what I want now...

TorsteinHonsi commented 7 years ago

The editor shows initially Legend.Format={y} but displays the value of {point.name}. Not a big deal when you know it.

@cvasseng This is probably also something that is set in the template, but not reflected in the GUI.