javascriptfusioncharts

How I can make slices a link in FusionChart js multilevelpie?


I want make clickable links in pie chart.

I used FusionCharts.js. How I make links in chart?

For example (FusionChart.js create multilevelpie chart with slices "seafood", "breads", "clothing", "sun glasses", "food & beverages", "apparel & accessories"):

FusionCharts.ready(function() {
  var topProductsChart = new FusionCharts({
    type: 'multilevelpie',
    renderAt: 'chart-container',
    id: "myChart",
    width: '400',
    height: '400',
    dataFormat: 'json',
    dataSource: {
      "chart": {
        "theme": "fusion",
        "caption": "Split of Top Products Sold",
        "subCaption": "Last Quarter",
        "captionFontSize": "14",
        "subcaptionFontSize": "14",
        "baseFontColor": "#333333",
        "baseFont": "Helvetica Neue,Arial",
        "basefontsize": "9",
        "subcaptionFontBold": "0",
        "bgColor": "#ffffff",
        "canvasBgColor": "#ffffff",
        "showBorder": "0",
        "showShadow": "0",
        "showCanvasBorder": "0",
        "pieFillAlpha": "60",
        "pieBorderThickness": "2",
        "hoverFillColor": "#cccccc",
        "pieBorderColor": "#ffffff",
        "useHoverColor": "1",
        "showValuesInTooltip": "1",
        "showPercentInTooltip": "0",
        "numberPrefix": "$",
        "plotTooltext": "$label, $$valueK, $percentValue",
        "pieRadius": "170"
      },
      "category": [{
        "label": "Sales by category",
        "color": "#ffffff",
        "value": "150",
        "category": [{
            "label": "Food & {br}Beverages",
            "color": "#f8bd19",
            "value": "55.5",
            "category": [{
                "label": "Breads",
                "color": "#f8bd19",
                "value": "11.1"
              },
              {
                "label": "Seafood",
                "color": "#f8bd19",
                "value": "6.66"
              }
            ]
          },
          {
            "label": "Apparel &{br}Accessories",
            "color": "#e44a00",
            "value": "42",
            "category": [{
                "label": "Sun Glasses",
                "color": "#e44a00",
                "value": "10.08"
              },
              {
                "label": "Clothing",
                "color": "#e44a00",
                "value": "18.9"
              },
            ]
          },
        ]
      }]
    }
  });

  topProductsChart.render();
});

Live demo: http://jsfiddle.net/cebu68vt/

I want this slices, for example - "Breads", be a clickable link.


Solution

  • In order to set a link to a specific Pie plot please set link attribute for that data object here is an example

    {
       "label": "Breads",
       "color": "#f8bd19",
       "value": "11.1",
       "link":"https://www.fusioncharts.com/dev"
       }
    

    Check this demo - http://jsfiddle.net/byzre3vj/

    To know more about this feature check here - https://www.fusioncharts.com/dev/chart-guide/chart-configurations/drill-down