0
votes

I have integrated the fusion pie chart with below code:

app.component.ts file

const data = {
  chart: {
    caption: "Checkout Programs",
    subcaption: "",
    showvalues: "1",
    showpercentintooltip: "0",
    numberprefix: "Serial:",
    enablemultislicing: "1",
    theme: "fusion"
  },

  data: [ 
{
  "label": "card",
  "value": 1
}, {
  "label": "Currency",
  "value": 2
}, {
  "label": "Holding",
  "value": 3
}, {
  "label": "Payment Network",
  "value": 4
}
 ]
};

and below lines in app.component.html file:

 <fusioncharts
    [width]="width"
    [height]="height"
    [type]="type"
    [dataFormat]="dataFormat"
    [dataSource]="dataSource"
    >
  </fusioncharts>

Image:

enter image description here

Now, I want to run some function if user clicks the pie chart slice (Onclick() event in pie chart slice). and I just want to get the label value inside the method. if user clicks "card" slice in pie chart then the method prints console.log(event); as "cards".

Can anyone help me to achieve this.

2
I have never used fusioncharts before, but is it not just a matter of referencing and using the events listed here: fusioncharts.com/dev/api/fusioncharts/fusioncharts-events. Probably entityClick? ā€“ Theunis
It works. Thanks. I just used the above link and added events in the component.ts file and look good now. Thank you.. Please add it as answer I will accept it ā€“ ArrchanaMohan

2 Answers

0
votes

Thanks to Theunis for point out an exact solution that I'm looking for.

Used the same code base that mentioned under entityClick:

Please refer below link:

https://www.fusioncharts.com/dev/api/fusioncharts/fusioncharts-events

Thanks once again.

0
votes

You can use the Fusion Charts event reference page to find events available on the fusioncharts component. Iā€™m not entirely sure what the coverage is for the Angular component, but it does seem to be implemented to some degree:

https://www.fusioncharts.com/dev/api/fusioncharts/fusioncharts-events

It seems like the entityClick would satisfy your requirement.