Ahmed
Posts: 4
Joined: Thu Sep 23, 2021 9:12 am

How to set X-Axis values min,median,max dynamically

stockOptions() {
return {
rangeSelector: {
selected: 1
},
chart:{
type:"area",
zoomType: 'xy'
},
xAxis: {
minPadding: 0,
maxPadding: 0,
plotLines: [{
color: '#888',
value: 0.007,
width: 1,
label: {
text: '',
rotation: 90
}
}],
},
credits: {
enabled: false
},
yAxis: [{
lineWidth: 1,
gridLineWidth: 1,
title: null,
tickWidth: 1,
tickLength: 5,
tickPosition: 'inside',
labels: {
align: 'left',
x: 8
} },
{
opposite: true,
linkedTo: 0,
lineWidth: 1,
gridLineWidth: 0,
title: null,
tickWidth: 1,
tickLength: 10,
tickPosition: 'inside',
labels: {
align: 'right',
x: -8
}
}],
plotOptions: {
area: {
fillOpacity: 0.2,
lineWidth: 1,
step: 'center'
}
},
title: {
text: ''
},
series: [
{
name: 'Bids',
data:this.BidData,
color: '#27c779',
},
{
name: 'Asks',
data: this.AskData,
color: '#e94c43'
}
],

}
}
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: How to set X-Axis values min,median,max dynamically

Hello,

Welcome to our forum and thanks for contacting us with your question!

Could you say something more about what you want to achieve? Could you reproduce the issue in an online editor like JSFiddle?
It will be easier to help me. Here you have a template that you can use: https://jsfiddle.net/BlackLabel/5fxdog6c/

Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/
Ahmed
Posts: 4
Joined: Thu Sep 23, 2021 9:12 am

Re: How to set X-Axis values min,median,max dynamically

assume i have 10 numbers, i need to select min, median and max value among 10 numbers and put it on X-Axis.
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: How to set X-Axis values min,median,max dynamically

Hi,

If I understand correctly, do you want to set the tick values on the Y-axis (on the right side of the graph as the X-axis is below)? You can do this by specifying these values in tickPositions, then you also have to set showFirstLabel and showLastLabel to true. To assign this data dynamically you need to do it in the load event.

Demo: https://jsfiddle.net/BlackLabel/4572azon/

tickPositions: https://api.highcharts.com/highcharts/y ... kPositions
showFirstLabel: https://api.highcharts.com/highcharts/y ... FirstLabel
showLastLabel: https://api.highcharts.com/highcharts/y ... wLastLabel

Let me know if that was what you were looking for!
Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/

Return to “Highcharts Stock”