You can customize the look and feel of your Highcharts graph by altering the options provided during the chart's creation. To change the color of lines and other elements, you can directly set the colors in the Highcharts.chart() options. Here's how to modify your existing code to make the lines white:
- Set the color of the line series to white (
'#FFFFFF'):
series: [{
name: 'Requests',
data: [],
color: '#FFFFFF', // Sets the series line color to white
}]
- If you also want to change the color of the text and the gridlines to white (or a lighter color for better contrast against a gray background), you can update the
yAxis and xAxis properties:
xAxis: {
type: 'datetime',
tickPixelInterval: 150,
labels: {
style: {
color: '#FFFFFF' // Changes the color of xAxis labels to white
}
},
lineColor: '#FFFFFF', // Changes the color of xAxis line to white
tickColor: '#FFFFFF' // Changes the color of xAxis ticks to white
},
yAxis: {
title: {
text: 'Requests/second',
style: {
color: '#FFFFFF' // Changes the color of yAxis title to white
}
},
labels: {
style: {
color: '#FFFFFF' // Changes the color of yAxis labels to white
}
},
gridLineColor: '#FFFFFF' // Changes the color of yAxis grid lines to white
},
- For completeness, let's also change the title color:
title: {
text: 'L7 DSTAT ~ http://127.0.0.1:5000/hit',
style: {
color: '#FFFFFF' // Changes the color of chart title to white
}
},
By making all the above modifications, the relevant sections of your code will look like this:
// Create the Highcharts graph
var chart = Highcharts.chart('requestCountGraph', {
chart: {
type: 'line',
backgroundColor: null,
events: {
load: requestDataUpdate
}
},
title: {
text: 'L7 DSTAT ~ http://127.0.0.1:5000/hit',
style: {
color: '#FFFFFF'
}
},
xAxis: {
type: 'datetime',
tickPixelInterval: 150,
labels: {
style: {
color: '#FFFFFF'
}
},
lineColor: '#FFFFFF',
tickColor: '#FFFFFF'
},
yAxis: {
title: {
text: 'Requests/second',
style: {
color: '#FFFFFF'
}
},
labels: {
style: {
color: '#FFFFFF'
}
},
gridLineColor: '#FFFFFF'
},
plotOptions: {
line: {
lineWidth: 2,
}
},
series: [{
name: 'Requests',
data: [],
color: '#FFFFFF'
}]
});
After adding these changes, the lines, text, and gridlines in your Highcharts graph should all be white, which will provide better contrast against a gray background.