简体   繁体   中英

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. Here in 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. when we click on the Month zoom button then only it is showing. If we click on All,6M,3M it is not showing.

$(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 . 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 :

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.

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.

There are several other options that can be viewed under the dataGrouping API reference . It comes down to how you want it to look and perform, and how much it should reflect the actual values.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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