AnyChart-Android icon indicating copy to clipboard operation
AnyChart-Android copied to clipboard

tooltip format round value

Open zeylevruntime opened this issue 4 years ago • 5 comments

hello, please help me i have code like this L2.tooltip().format("function() {" +"return 'Payment : ' + anychart.format.number(this.value * "+divider+")" +"}"); this code produce tooltip below

tanya

how to make round from tooltip value and formating with group separator? so i can get output rounded integer value like below

"Total : 5.562" ">120 : 494" "91-120 : 207" "61-90 : 779" "31-60 : 1.843" "Sell out : 3.631" "Payment : 1.649"

zeylevruntime avatar Sep 09 '20 06:09 zeylevruntime

@zeylevruntime For this purpose, you can use formatting parameters in a string token. Below is the snippet code:

        Cartesian cartesian = AnyChart.area();

        List<DataEntry> seriesData = new ArrayList<>();
        seriesData.add(new ValueDataEntry("A", 51234.23412));
        seriesData.add(new ValueDataEntry("B", 42342.242));
        seriesData.add(new ValueDataEntry("C", 32343.243234));
        seriesData.add(new ValueDataEntry("D", 4.42342));

        final Area series1 = cartesian.area(seriesData);

        cartesian.tooltip().format("{%value}{decimalsCount: 0, groupsSeparator:.}");

        anyChartView.setChart(cartesian);

Below is the result: Screenshot 2020-09-14 at 10 59 33

Shestac92 avatar Sep 14 '20 03:09 Shestac92

oke, its work , thanks.. if you wish I ask another question? how to make area chart starting value from -(minus) like HiLo chart

zeylevruntime avatar Sep 15 '20 03:09 zeylevruntime

@zeylevruntime Do you want to apply low and high values to the area? Make it a range-area?

Shestac92 avatar Sep 15 '20 06:09 Shestac92

sW5XX

this is example in excel,area chart starting value can be <0, how to make area chart like this?

zeylevruntime avatar Sep 16 '20 08:09 zeylevruntime

@zeylevruntime The chart adjusts the yScale minimum automatically if the data includes negative values. Anyway, you can apply the yScale negative minimum manually. Like this:

chart.yScale().minimum(-2000);

Shestac92 avatar Sep 16 '20 14:09 Shestac92