HighCharts:向点添加不同类型的数据

时间:2014-04-01 23:07:59

标签: javascript json highcharts

根据HighChart Api积分有几个变量:

color dataLabels x,y,drilldown,events ... etc

有没有办法在点上添加额外的变量,以便在javasciprt函数中达到它们:

同样的事情可能是系列......

示例:

PHP

array_push($finalArray,array(x=> $date,y => ($total_income - $total_cost), credit => $total_cost, income => $total_income));
...
echo "leagueID: '" . $leagueID ."' ," ; 
echo "data:" ;
echo json_encode($finalArray) . "},";

JSON输出

{leagueID: '1' ,data:[{"x":1395180000000,"y":85.28,"credit":35,"income":120.28}

的JavaScript

events: {
    click: function() {
        profit_company_change(this.series.options.leagueID);//It is possible, it can find this.series.options.leagueID)

JavaScript 2

 ...+ '$</b><br/>Tatal credit: <b>' + this.credit +'$</b><br/>Profit: <b>'+ this.y ; // This is not possible because of this.credit

1 个答案:

答案 0 :(得分:0)

您可以使用以下内容:

series:[{
  data:[{
    y:20,
    customParameter: 'loreum ipsum'
   },1,2,3]
}]

然后此参数将在point.options对象中可用。