简体   繁体   English

Highstock在不缩放的情况下不显示最大数据值

[英]Highstock Not showing max data value without Zoom

My question is same as addressed here , I am not able to add comment to that question. 我的问题与此处的问题相同,我无法对该问题添加评论。 Highstock is Not able to show max data point without zoom. 如果没有缩放,Highstock将无法显示最大数据点。 Here in JsFiddle . JsFiddle中 I am getting data values of y-axis between 0 t0 1.7, but am getting max value is 3.19(See in Fiddle April 9 22:53), it is not showing. 我正在0到1.7之间获取y轴的数据值,但是正在获取最大值是3.19(请参见4月9日,小提琴,22:53),它没有显示。 when we click on the Month zoom button then only it is showing. 当我们单击“月份”缩放按钮时,仅显示它。 If we click on All,6M,3M it is not showing. 如果我们单击All,6M,3M,则不会显示。

$(document).ready(function(){
    var seriesOptions = [];
    var xaAxisData=[];

    var yAxisData=[]; 

for (var i=0; i<xaAxisData.length && i<yAxisData.length; i++){
    seriesOptions.push([xaAxisData[i],yAxisData[i]]);
       }
    // Create the chart
    var chart =new Highcharts.StockChart({
        chart: {
               renderTo: "container",
               height: 500,
               zoomType: 'x'
           },
        rangeSelector : {
            selected : 1,
            inputEnabled: $('#container').width() > 280
        },
        title : {
            text : 'AAPL Stock Price'
        },
        credits: {
              enabled: false
          },
        xAxis: {
                title: {
                   text: 'Time'
               },
               type: 'datetime',
               },
               yAxis: {
                   title: {
                       text: "Stock "
                   },
                   lineWidth: 1,
                   min:0,
                   gridLineWidth: 0,
                   endOnTick : false,
                   max:5

               },

        series : [{
            name : 'AAPL',
            showInLegend: true,
            data : seriesOptions,
            lineWidth : 1,
            marker : {
                enabled : true,
                radius : 2
            }
        }]
    });
} );

The problem is dataGrouping . 问题是dataGrouping When zoomed far out it no longer shows all the points, but rather each "point" is a combination of several points, and are shown as a average. 缩小时,它不再显示所有点,而是每个“点”都是多个点的组合,并显示为平均值。

This is because these are (two of) the default opptions for dataGrouping : 这是因为,这些都为默认opptions(二) dataGrouping

dataGrouping: {
    enabled: true,
    approximation: 'average'
}

You could do enabled: false ( JSFiddle example ), but you might find that this dramatically slows down your chart, depending on the data size. 您可以enabled: falseJSFiddle示例 ),但是您可能会发现,这会极大地降低图表的速度,具体取决于数据大小。

If you are really keen on seeing the "top" points you could to approximation: 'high' ( JSFiddle example ), which would show the highest value within each grouping. 如果您真的很想看到“最高”点,可以approximation: 'high'一下approximation: 'high'JSFiddle示例 ),它将在每个分组中显示最高值。

There are several other options that can be viewed under the dataGrouping API reference . dataGrouping API参考下还可以查看其他几个选项。 It comes down to how you want it to look and perform, and how much it should reflect the actual values. 这取决于您希望它的外观和性能,以及它应多少反映实际值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM