vjj

Members
  • Content count

    2
  • Joined

  • Last visited

Posts posted by vjj


  1. @SantoshNavle Thanks for the response. I tried this but it replaces the parent data but not the child data. How to set linkedchart array within parent json. If you have any fiddle it could be helpful..

    Sample example below.

    FusionCharts.ready(function () {
          var fusioncharts = new FusionCharts({
            type: 'column2d',
            renderAt: 'chart-1,
            dataFormat: 'json',
            dataSource: {
              // Chart Configuration
              chart:{
               //chart configs
              },
              "data": data.data,
              "linkeddata": [], // how to set this array in dynamic way.?
              "dataset": data.dataset,
              "categories": data.categories,
              "lineset": data.lineset,
            },
            events: {
              beforeLinkedItemOpen: function(ev:any, props1:any) {
                 console.log('beforeLinkedItemOpen ev--',ev);
                 console.log('beforeLinkedItemOpen props--',props1);
              },
              dataPlotClick: function(ev:any, props1:any) {
                 console.log('data click--',props1.categoryLabel);
                 
    			 //fetch dynamic content on click of any plot
                 let fetch = fetchDrillDownData(props).then(x=>{
                   
                  let categories = x.fields.categories
                  let dataset = x.fields.dataset;
      
                  console.log(categories);
                 
                  let linkeddata = [] as any;
                  let linkedchart = {} as any;
                  linkedchart["chart"]= {
                   //dynamic chart config
                  };
                  linkedchart["categories"] = categories;
                  linkedchart["dataset"] =dataset;
                  linkeddata.push({"id":"level-0-"+props.categoryLabel,"linkedchart":linkedchart});
                  console.log('linked----',linkeddata);
                   //tried all below variants which is not working
                  fusioncharts.setJSONData(linkeddata);
                  fusioncharts.setChartData({'linkedchart':linkeddata});
                });
              }
            }
          });