Waqar ul islam
Waqar ul islam

Reputation: 498

Force HighChart Line graph to start from 1st Tick Value

I am using Highstocks. I have a series graph with multiple range selectors. My data is coming in JSON format form c# code behind. The problem I am facing is that for some range selectors my graph line starts from extreme left though I want it to start from the first tick value OR Ideally my first tick value should be on left most. For example: In below image the line should start from 8 January OR the 8 January should be on the left most side.

I have already tried StartOnTick = true, PointPlacement = 'on' but nothing works for me. Is there a way to force the graph line to start from tick?

I am adding a fiddle of this problem. Click on 1day selector to see the problem. I just need to start tick value from extreme left for every selector.

Fiddle link

 Highcharts.stockChart('dynamicGoldChart', {


   scrollbar: {
     enabled: false
   },
   xAxis: {
     alternateGridColor: true,
     //startOnTick: true,

     labels: {

       rotation: 0, //280
       style: {
         'color': 'black',
         'fontSize': '11px',
         'font-weight': 'bold'
       }
     }

   },
   yAxis: {
     labels: {
       align: 'left',
       format: '{value:.0f}',
       x: 0,
       y: -2,
       style: {
         'color': 'black',
         'fontSize': '11px',
         'font-weight': 'bold'
       }
     },

     title: {
       text: 'Per Ounce',
       style: {
         'color': 'black',
         'fontSize': '14px',
         'font-weight': 'bold'
       },


     }
   },


   rangeSelector: {


     buttons: [{
         count: 10,
         type: 'minute',
         text: '10m',
         dataGrouping: {
           enable: false,
           approximation: 'close'
           //forced: true,
           //units: [['minute', [1]]]

         }

       }, 

enter image description here

Upvotes: 2

Views: 142

Answers (0)

Related Questions