English 中文(简体)
添加从html文箱输入高图
原标题:add input from html text box into highcharts graph

我有一张纸张,我想在现在开展活动,并在图表中显示。 这部课以罚款,具体一天作为直径寄给我的以下服务。 我希望能够通过案文投入来改变所描述的日子。 下面使用的是“ChartData”方法,该图的斜线是这样。 为什么这样做?

$(function () {
  var chart;
  $(document).ready(function () {
    var options = {
      chart : {
        renderTo :  container ,
        type :  column 
      },
      title : {
        text :  Total by Time ,
        x : -20 //center
      },            
      xAxis : {
        categories : [ 1am ,  2am ,  3am ,  4am ,  5am ,  6am ,  7am ,  8am ,  9am ,  10am ,  11am ,  12pm ,  1pm ,
           2pm ,  3pm ,  4pm ,  5pm ,  6pm ,  7pm ,  8pm ,  9pm ,  10pm ,  11pm ,  12am ]
      },
      yAxis : {
        min : 0,
        title : {
          text :  Total 
        },
        stackLabels : {
          enabled : true,
          style : {
            fontWeight :  bold ,
            color : (Highcharts.theme && Highcharts.theme.textColor) ||  gray 
          }
        }
      },
      tooltip : {
        formatter : function () {
          return  <b>  + this.series.name +  </b><br/>  +
          this.x +  :   + this.y;
        }
      },
      legend : {
        layout :  vertical ,
        align :  right ,
        verticalAlign :  top ,
        x : -10,
        y : 100,
        borderWidth : 0
      },
      plotOptions : {
        column : {
          stacking :  normal ,
          dataLabels : {
            enabled : true,
            color : (Highcharts.theme && Highcharts.theme.dataLabelsColor) ||  white 
          }
        }
      },
      series : []
    };      
    getChartData();
  });   
});

function getChartData() {
  $.getJSON( http://localhost:8080/myservice/2012-03-23 , function (data) {

    options.series = data;
    // Create the chart
    var chart = new Highcharts.Chart(options);
  });   
}
最佳回答

如果从表格中分出两个参数,你就可以获得这些参数,并使用SapChartData url中的数值,如:

 parts = window.location.search.substr(1).split("&");
 var $_GET = {};
 var custNoPart = parts[0].split("=");
 var dayDatePart = parts[1].split("=");

 var param1 = $_GET[decodeURIComponent(custNoPart[0])] = decodeURIComponent(custNoPart[1]);

  var param2 = $_GET[decodeURIComponent(custNoPart[1])] = decodeURIComponent(dayDatePart[1]);
问题回答

引证:

$(function () {
  var chartOptions = {
    chart : {
      renderTo :  container ,
      type :  column 
    },
    title : {
      text :  Total by Time ,
      x : -20 //center
    },
    xAxis : {
      categories : [ 1am ,  2am ,  3am ,  4am ,  5am ,  6am ,  7am ,  8am ,  9am ,  10am ,  11am ,  12pm ,  1pm ,
         2pm ,  3pm ,  4pm ,  5pm ,  6pm ,  7pm ,  8pm ,  9pm ,  10pm ,  11pm ,  12am ]
    },
    yAxis : {
      min : 0,
      title : {
        text :  Total 
      },
      stackLabels : {
        enabled : true,
        style : {
          fontWeight :  bold ,
          color : (Highcharts.theme && Highcharts.theme.textColor) ||  gray 
        }
      }
    },
    tooltip : {
      formatter : function () {
        return  <b>  + this.series.name +  </b><br/>  +
        this.x +  :   + this.y;
      }
    },
    legend : {
      layout :  vertical ,
      align :  right ,
      verticalAlign :  top ,
      x : -10,
      y : 100,
      borderWidth : 0
    },
    plotOptions : {
      column : {
        stacking :  normal ,
        dataLabels : {
          enabled : true,
          color : (Highcharts.theme && Highcharts.theme.dataLabelsColor) ||  white 
        }
      }
    }
  };
  getChartData(chartOptions);
});

function getChartData(chartOptions) {
  $.getJSON( http://localhost:8080/myservice/2012-03-23 , function (data) {
    chartOptions.series = data;
    // Create the chart
    var chart = new Highcharts.Chart(chartOptions);
  });
}




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签