I don't see the range selector, but I have written that in the code. I have initialized the chart using variable, like:
var chart = Highcharts.chart('chartContainer', {
xAxis: {
type: 'datetime',
tickPixelInterval: 150
},
yAxis: {
title: {
text: 'Érték'
},
plotLines: [{
value: 0,
width: 20,
color: '#FFFFFF'
}]
},
//animation: Highcharts.svg,
boost: {
seGPUTranslations: true
},
rangeSelector: {
buttonTheme: { // styles for the buttons
fill: 'none',
stroke: 'none',
'stroke-width': 0,
r: 8,
style: {
color: '#039',
fontWeight: 'bold'
},
allButtonsEnabled: true,
states: {
hover: {},
select: {
fill: '#039',
style: {
color: 'white'
}
}
// disabled: { ... }
}
}
},
title: {
text: 'Prociszenzor'
},
series: []
});
As you see it doesn't contain any series, I do add it from an another code:
chart.addSeries({
type: 'line',
name: dataaa.ertekek[i].neve + " " + dataaa.ertekek[i].mertek,
data: [{
y: dataaa.ertekek[i].ertek / 100,
x: time
}]
});
Dataaa is from a JSON file. I do push this array to the main chart array, and I add points to this using addPoint function. I want to make a rangeselector, but I don't have idea how to do this.
As you have posted no example of what you are expecting I am assuming.
I made the following jsfiddle based on your code. Note that I did the following changes from what I can see you have posted.
<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/stock/highcharts-more.js"></script>
I am note sure if you are using the highstock library, but if you want a range selctor, you should. See highcharts.com/docs/chart-concepts/range-selector
var chart = Highcharts.stockChart('container', {
I changed chart
to be a stockChart
.
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.