融合图表 - 如何在ploating后定义第2d列中的某些onclick事件

时间:2014-01-09 06:16:13

标签: fusioncharts

我正在使用融合图表,它在ipad中工作得非常好。我的代码如下所示

<html>
  <head>        
    <title>My First chart using FusionCharts - Using JavaScript</title>         
    <script type="text/javascript" src="FusionCharts.js"></script>
  </head>   
  <body>     
    <div id="chartContainer">FusionCharts XT will load here!</div>   
     <div id="chartContainer1" style="margin-left: 50%;
margin-right: 10%;
margin-top: -22%;">FusionCharts XT will load here!</div>   
    <script type="text/javascript"><!--

      var myChart = new FusionCharts( "Column2D.swf", 
                    "myChartId", "500", "300",  "0", "0");
var dataString ='<chart palette="2" caption="Industries" xAxisName="Days in Month" yAxisName="" labelDisplay="Rotate" showValues="0" decimals="0" formatNumberScale="0" bgcolor="FFFFFF" useRoundEdges="1" bgColor="FFFFFF,FFFFFF" showBorder="0">\n\
 <set value="20" label="Electric Power Generation" color="005C8E"/>\n\
 <set value="32" label="Industrial Processes" color="00759B"/>\n\
 <set value="12" label="Residential and Commercial Activities" color="0296D2"/>\n\
 <set value="20" label="Agriculture" color="40C7F9"/>\n\
 <set value="2" label="Waste Disposal" color="00496C"/>\n\
 </chart>';
  myChart.setXMLData( dataString );
 myChart.render("chartContainer"); 

    // -->  
    </script>      
  </body> 
</html>  

现在我想点击柱形图上的其他一些活动。例如,如果我点击农业,其价值为20,那么基于此值,我想要一些搜索活动或任何其他活动。就像我点击农业一样,它将转到我可以点击农业定义的其他事件。只是让我知道如何在第2列图表上应用点击事件。

以下代码正在按照要求运行,但仅适用于firefox。请让我知道在所有浏览器和移动设备上工作所需的任何内容。

<html>
  <head>
    <title>JavaScript Link Example</title>
    <script language="JavaScript" src="FusionCharts.js"></script>
    <SCRIPT LANGUAGE="JavaScript"><!--
      function myJS(myVar){
          window.alert(myVar);
      }
    // --></SCRIPT>
  </head>
  <body bgcolor="#ffffff">
    <div id="chartdiv" align="center">The chart will appear within this DIV. This text will be replaced by the chart.</div>
    <script type="text/javascript"><!--
        var myChart = new FusionCharts("Charts/Column2D.swf", 
        "myChartId", "500", "300", "0", 
        "0");
       myChart.setXMLUrl("Data.xml");
       myChart.render("chartdiv");
    // --></script>
  </body>
</html>  

这是Data.xml内容

<chart caption='ABC Bank Branches' subCaption='(In 
      Asian Countries)' yaxislabel='Branches' xaxislabel='Country'>
    <set label='Hong Kong' value='235' link="JavaScript:myJS('Hong Kong,235');"/> 
    <set label='Japan' value='123' link="JavaScript:myJS('Japan, 123');"/>
    <set label='Singapore' value='129' link="JavaScript:myJS('Singapore, 129');"/> 
    <set label='Malaysia' value='121' link="JavaScript:myJS('Malaysia, 121');"/> 
    <set label='Taiwan' value='110' link="JavaScript:myJS('Taiwan, 110');"/> 
    <set label='China' value='90' link="JavaScript:myJS('China, 90');"/> 
    <set label='S. Korea' value='86' link="JavaScript:myJS('S.Korea, 86');"/> 
</chart>

0 个答案:

没有答案