Highcharts - How to start the x axis from an arbitrary value

I use [highcharts] [1] to plot between a range of values ​​from a database. I want X Axis values ​​to start with user input.

For example, if the user wants values ​​between the range of 50 and 100, I want my x axis to start at 50.

The range will have a variable size. The data size is large, so I can not do something like getting everyone and using min and max to display.

Thanks in advance.

This is my chart object. I have two input fields for the user, which I use to query the database and return the rows between them.

I use several types of charts. The problem is that I have no idea how to determine the beginning of the X axis as 50 if I get data from a database between 50 and 100. It shows 50 values, but it starts from 0 to 50.

I tried min. 10 and so on. It starts with this value, but skips the first 10 or so values.

The input field has id 'lower' and 'upper'.


var options = { chart: { renderTo: ctn.attr('id'), type: $('#graph_type option:selected').val(), zoomType: 'x' }, title: { text: $('#graph_title').val() }, subtitle: { text: "Graph - " + (graph_no + 1) }, xAxis: { title: { text: $('#x_label').val() } }, yAxis: { title: { text: $('#y_label').val() } }, credits: { enabled: false }, series: [] }; 
+6
source share
2 answers

Thanks to everyone for the answer. I have found a solution. Min max didn't actually do as I wanted it.

I have found a solution.

To start the x axis value from the desired value, use

 plotOptions: <your_graph_type>:{ pointStart: <your_value> } 
+10
source

I think setting min and max for xAxis will work. Refer to this link

and you can say

startOnTick: false, endOnTick false

For example, contact: example

I have min values ​​set from y to 20 and max to 217,

 yAxis: { min: 20, max:217, startOnTick: false, endOnTick:false }, 

See how the chart is displayed. Hope this helps.

+7
source

All Articles