AnyChart / AnyChart-Android

AnyChart Android Chart is an amazing data visualization library for easily creating interactive charts in Android apps. It runs on API 19+ (Android 4.4) and features dozens of built-in chart types.
2.3k stars 368 forks source link

How to display percent sign (%)? #74

Closed whruiqlik closed 5 years ago

whruiqlik commented 5 years ago

Please tell me how to display percent sign (%). Thank you. 0.7 --> 70%

20190215091932

Shestac92 commented 5 years ago

@whruiqlik You can achieve that using the same string token in the labels formatter like this:

series.labels().format('{%value}%');
whruiqlik commented 5 years ago

@Shestac92 I copied it into Data Lables, but the result wasn't what I wanted.

20190218122256

Shestac92 commented 5 years ago

@whruiqlik Excuse me, I got your idea in the wrong way in the beginning. You can achieve that using special token. Please, try the following token for Data Labels: `{%yPercentOfCategory}%}

whruiqlik commented 5 years ago

Thank you. It's okay to use it in Staked Bar Chart, but it's no OK to use it in Combo Chart. Please look at the picture.Thank you. ok1 a1 a2

whruiqlik commented 5 years ago

How can this problem be solved? "it's no OK to use it in Combo Chart."

Shestac92 commented 5 years ago

@whruiqlik Excuse me for the late reply. As I can see from the screenshot the pink line represents points related to the yAxis on the right side. What values should the label show? Please, correct me I got your idea in a wrong way. For example, the first point of the line series has a value of 0.8 and it's related to the yAxis on the right side. Should it show the label '0.8 %'? If so, you can add the following token {%value}%

whruiqlik commented 5 years ago

I want to show percentages in the composite chart. For example, 0.8 - > 80%. But I can't succeed in trying the following methods.

{%Value} --> 0.8 1

{%yPercentOfCategory}% --> 1.05% 2

Shestac92 commented 5 years ago

@whruiqlik Unfortunately, for this purpose, there's no token to recalculate value to the percentage. You should preprocess the value before applying it to the chart. All available options you can check in this article.

whruiqlik commented 5 years ago

I used {% value} {decimalsCount: 1} and multiplied the data by 100, but the exported data was also multiplied by 100. How can I export normal data?

1 2

Shestac92 commented 5 years ago

@whruiqlik This is normal behavior. The series is connected to the scale on the right side of the chart. You can adjust the series position by applying this scale min/max values manually. Your series doesn't include negative values, so, there's no need in scale min -100%. In "scales" tab adjust the scale min/max value to adjust the series position on the chart.

whruiqlik commented 5 years ago

Thank you! How can I export the correct data? 20190312184802

Shestac92 commented 5 years ago

@whruiqlik I'm afraid I have lost the flow of the issue. This screenshot is from an Excel document? Was it exported from Qlik Sense? What are the raw values of "Achieving %" column? According to the chart, the first value should be 54.76

whruiqlik commented 5 years ago

Please look at the pictures below. Please help me. Thank you.

111111111

Shestac92 commented 5 years ago

@whruiqlik Do you multiply the raw value in the expression function? I'm afraid you should turn to the Qlik Support regarding export data to excel. The exporting feature is provided by Qlik Sense, the AnyChart extension can't affect the data in the Qlik table.

whruiqlik commented 5 years ago

When I was looking for ways in AnyChart Documentation, I found the same problem there. I don't know how to solve this problem.

A1

B1

Shestac92 commented 5 years ago

@whruiqlik I'm afraid we miss something on this issue. The sample from the docs you provided in your previous comment provides the following xlsx with correct values: Screenshot 2019-03-18 at 11 32 47

Do you implement the format conversion by yourself then?

whruiqlik commented 5 years ago

How can I add a percentage sign?

20190404183611

Shestac92 commented 5 years ago

@whruiqlik Unfortunately, the exporting function provides only raw values (numbers as integer) without formatting or additional symbols.

whruiqlik commented 5 years ago

ok, Thank you.