Darshan
Darshan

Reputation: 760

how to Trim xAxis scale in highstock?

I'm using HighStock.js to build the graph of a stock ticker, and i need to display 2 days data into a graph , and i don't have data when stock market closes , so i'm getting straight line from Nov 27 11:20 to Nov 28 5:19 . I should not get any line when stock closes, that line should be trimmed along with x-axis. I'm having prices in the interval of every 20 mins for 2 days. Below is my code,

$.each(names, function(i, name) {

  if(i==0)
  {
     seriesOptions[i] = {   
           name: name,

           data:  [<?php  echo join($data0, ',') ?>],
        };

    }
    else if(i==1)
    {

date3:[<?php  echo $date1 ?>];



   seriesOptions[i] = {   
           name: name,
           data:  [<?php  echo join($data1, ',') ?>],
        };
  }
  else if(i==2)
  {
   seriesOptions[i] = {   
           name: name,
           data:  [<?php  echo join($data2, ',') ?>]
        };
  }

        seriesCounter++;

        if (seriesCounter == names.length) {
        createChart();
        }

    });



function createChart() {

    var date_new1 ;

    var date_new2 ;

    chart = new Highcharts.StockChart({
        chart: {
        renderTo: 'container'
        },

    dataLabels: {
           enabled: true
        },


    yAxis: {
        title: {
        text: 'PRICE',
        },

    },

        xAxis: {
        title: {
          text: 'PERIOD',
         },
        type: 'datetime',
        dateTimeLabelFormats: {
        second: '%Y-%m-%d<br/>%H:%M:%S',
        minute: '%Y-%m-%d<br/>%H:%M',
        hour: '%Y-%m-%d<br/>%H:%M',
        day: '%Y<br/>%m-%d',
        week: '%Y<br/>%m-%d',
        month: '%Y-%m',
        year: '%Y'
        },
        plotLines: [{
            value: 0,
            width: 1,
            color: '#808080'
         }]
    },

        navigator: {
        enabled: false,
    },

    rangeSelector: {
      enabled: false
    },

    legend: {
        enabled: true,
        align: 'right',
        backgroundColor: '#FCFFC5',
        borderColor: 'black',
        borderWidth: 2,
        layout: 'vertical',
        verticalAlign: 'top',
        y: 100,
        shadow: true
    },

    series: seriesOptions



    });
    }

});

enter image description here

Upvotes: 0

Views: 577

Answers (1)

eolsson
eolsson

Reputation: 12727

The feature to automatically collapse weekends is not completely implemented yet. It is scheduled for the next release of highstock (the one after 1.0.2). Here is the corresponding feature request: on uservoice

Upvotes: 1

Related Questions