1

我正在尝试创建此图 http://www.fusioncharts.com/demos/gallery/#line-and-area

如果你看右边的行,那么第三行。(照片 9,共 14 张)。

这是我使用的代码:

$this->load->plugin( 'fusion' );  
        $FC =  FusionCharts("MSLine","620","400");  

         $strParam="palette=2;showvalues=1;numvdivlines=10;drawanchors=0;numberprefix=$;divlinealpha=30;alternatehgridalpha=20;
setadaptiveymin=1;";
           # Set chart attributes 
               $FC->setChartParams($strParam);
           # Add category names
           $FC->addCategory("2001");
           $FC->addCategory("2002");
           $FC->addCategory("2003");
           $FC->addCategory("2004");
           $FC->addCategory("2005");
           # Add category names
          # Add Multi-series  Dataset
           $FC->createMSStDataset();
           # Add Multi-series dataset with in dataset
           $FC->addMSStSubDataset("Product A", "");
            # Add set data for plotting the chart
           $FC->addChartData("30");
           $FC->addChartData("26");
           $FC->addChartData("29");
           $FC->addChartData("31");
           $FC->addChartData("34");
            $FC->createMSStDataset();
           # Add Multi-series dataset with in dataset
           $FC->addMSStSubDataset("Product B", "");
           # Add set data for plotting the chart
           $FC->addChartData("1");
           $FC->addChartData("6");
           $FC->addChartData("123");
           $FC->addChartData("4");
           $FC->addChartData("132");
                echo $FC->renderChart();

出于某种原因,我看不到 2 行,我只能看到 1 :/我做错了什么?

4

1 回答 1

2

对于MSLine图表,您需要使用addDataset而不是createMSStDatasetor addMSStSubDataset

MSStackedColumn2DLineDY注意:$FC->createMSStDataset或$FC->addMSStSubDataset 用于MSStackedColumn2D图表。

因此,您的代码将是:

       $this->load->plugin( 'fusion' );  
       $FC =  FusionCharts("MSLine","620","400");  

       $strParam="palette=2;showvalues=1;numvdivlines=10;drawanchors=0;numberprefix=$;divlinealpha=30;alternatehgridalpha=20;setadaptiveymin=1;";

       # Set chart attributes 
       $FC->setChartParams($strParam);
       # Add category names
       $FC->addCategory("2001");
       $FC->addCategory("2002");
       $FC->addCategory("2003");
       $FC->addCategory("2004");
       $FC->addCategory("2005");
       $FC->addDataset("Product A", "");
        # Add set data for plotting the chart
       $FC->addChartData("30");
       $FC->addChartData("26");
       $FC->addChartData("29");
       $FC->addChartData("31");
       $FC->addChartData("34");

       $FC->addDataset("Product B", "");
       # Add set data for plotting the chart
       $FC->addChartData("1");
       $FC->addChartData("6");
       $FC->addChartData("123");
       $FC->addChartData("4");
       $FC->addChartData("132");
       echo $FC->renderChart();

参考:http ://docs.fusioncharts.com/charts/?guide-for-web-developers/fusioncharts-php-class/MultiSeriesChart.html

于 2013-02-27T14:04:51.123 回答