带有来自ajax的数据的Zoomable图表

时间:2018-05-07 11:33:07

标签: javascript asp.net-mvc highcharts

由于我是网络编程的新手(一般不是编程),我有一个基本问题:

我试图在APS.NET MVC中使用来自我的ajax responsem的数据构建一个可缩放的图表:

我的ajax响应是这些对象的列表:

public sealed class mVTCModel 
    {
        public string Id { get; set; }
        public DateTime LogTime { get; set; }
        public bool Valid { get; set; }
        public double mVTC { get; set; }
    }

我尝试过很多不同的东西。我在我的视图中有这个代码:

    标题               

    

</div>

<script type="application/javascript">

    Highcharts.setOptions({
      global: {
        useUTC: false
      }
    });

      $.ajax({
          type: 'GET',
          url: '/api/Api',
          data: { },
          success:function(response)
          {
              console.time('line');
              Highcharts.chart('container', {

                chart: {
                  zoomType: 'x'
                },

                title: {
                  text: 'Power Query mVTC'
                },

                subtitle: {
                  text: ''
                },

                tooltip: {
                  valueDecimals: 2
                },

                xAxis: {
                  type: 'datetime'
                },

                series: [{
                  data: response,
                  lineWidth: 0.5,
                  name: 'Hourly data points'
                }]

              });
              console.timeEnd('line');


          },
          error:function(){

          }
        });


</script>

 

相信我的问题在这里:

    series: [{
              data: response, <-- HERE (I suppose)
              lineWidth: 0.5,
              name: 'Hourly data points'
            }]

由于我没有告诉图表什么是x轴,什么是Y轴。

简而言之,我如何将x轴映射到 LogTime ,将y轴映射到 mVTC

0 个答案:

没有答案