user2463093
user2463093

Reputation: 11

How to replace percentage value to replace with some string value in percentage specific 2d horizontal fusion charts

I have a 2D horizontal stack chart and it is based on percentage so in each stack it is showing percentage but my requirement is to show some string in place of percentage. I have seen in fusion chart documents and it is mentioned to use displayValue attribute to provide some other value to display but it doesn't work as I am specifying tool-text. Below URL is giving this information. http://docs.fusioncharts.com/charts/contents/?guide-for-web-developers/php/PHP_BasicExample.html But I don't know how to specify tool-text. Please help!!!

Upvotes: 0

Views: 1509

Answers (2)

Aman Saraswat
Aman Saraswat

Reputation: 172

To Configure Text Labels instead of Numeric Data Values, Specify the text you want to display using the displayValue attribute under data within the particular data plot.

Refer to the code below:

FusionCharts.ready(function() {
  var salesChart = new FusionCharts({
      type: 'column2d',
      renderAt: 'chart-container',
      id: 'myChart',
      width: '450',
      height: '300',
      dataFormat: 'json',
      dataSource: {
        "chart": {
          "theme": "fusion",
          "caption": "Quarterly Revenue",
          "subcaption": "Last year",
          "xAxisName": "Quarter",
          "yAxisName": "Amount (In USD)",
          "showValues": "1",
          "numberPrefix": "$"
        },
        "data": [{
          "label": "Q1",
          "value": "1950000"
        }, {
          "label": "Q2",
          "value": "1450000"
        }, {
          "label": "Q3",
          "value": "1730000"
        }, {
          "label": "Q4",
          "value": "2120000",
          //Custom display string
          "displayValue": "Year's best"
        }]
      }
    })
    .render();
});

Column2d example JsFiddle

stackedcolumn2d example JsFiddle

Upvotes: 0

Pathic
Pathic

Reputation: 400

give numbersuffix='%25' to display '%' as suffix

sample : http://www.fusioncharts.com/free/docs/Contents/Adv_SpChar_Percent.html

Upvotes: 0

Related Questions