score:9
it is possible to set a background image or gradient using:
chart: {
type: 'line',
plotbackgroundimage: 'http://www.highcharts.com/demo/gfx/skies.jpg'
},
or
chart: {
type: 'line',
plotbackgroundcolor: {
lineargradient: [0, 0, 500, 500],
stops: [
[0, 'rgb(255, 255, 255)'],
[1, 'rgb(200, 200, 255)']
]
}
},
http://api.highcharts.com/highcharts#chart.plotbackgroundimage or http://api.highcharts.com/highcharts#chart.plotbackgroundcolor
however, this is the background to the plot area, not to the line itself. to give the line a graduated color, you can specify the color of the series as a gradient. e.g.
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
color: {
lineargradient: [0, 0, 0, 500],
stops: [
[0, 'rgb(255, 255, 255)'],
[1, 'rgb(100, 100, 155)']
]
}
}]
the syntax for lineargradients are:
lineargradient: [x1, y1, x2, y2]
creates a linear gradient object with a starting point of (x1, y1) and an end point of (x2, y2).
stops: [
[0, 'rgb(255, 255, 255)'],
[1, 'rgb(100, 100, 155)']
]
this specifies two points in the gradient and the colours to use. in this case, the gradient will go from (255,255,255) at the start to (100, 100, 155) and the end. if you specified 3 stops, then you can make the gradient go from one colour to another at the middle, to another at the end. hope this helps. i suggest you just try playing around with this in the jsfiddle i posted to see how it works.
score:4
to set background of a chart use chart.plotbackgroundimage. if you want to set image for whole chart, use css styles for container.
regarding gradient, it works, take a look: http://jsfiddle.net/fusher/2gzkd/3/
color: {
lineargradient: {
x1: 0,
y1: 0,
x2: 0,
y2: 1
},
stops: [
[0, 'red'],
[0.5, 'green'],
[1, 'blue']
]
},
Source: stackoverflow.com
Related Query
- Spline chart gradient fill
- Gradient Fill on Line Chart (Highcharts)
- Gradient fill for react-highcharts' line chart
- Highcharts Area chart gradient fill
- Highcharts spider chart with radial gradient fill not centered
- highcharts issues in pie chart with gradient fill
- spline chart highchart to fill the color in series
- Highchart Area Range chart with gradient that follows the line
- Highcharts spline chart points not showing unless zoomed in
- How to add gradient colors above chart line?
- HighCharts Stock Chart error code 18
- how to have a chart with no spline and no interpolation in Highcharts?
- HighCharts: How to display unique text for yAxis Label in a spline chart
- Highcharts - In area chart how to use gradient color for multiple series?
- Highcharts: Column Chart Select State Fill Color
- Markers/Circles in Spline chart in highcharts
- Area spline chart using Highchart
- Activity gauge High Chart with Gradient
- Remove line dots from the area spline chart
- Show Indicator at last point on Highchart spline chart
- How make to fill space after column was hidden in column chart using highchart?
- How to combine Scatter chart and area spline chart ?
- How to add opacity in spline chart
- Plot always starts at 0, highstock spline chart
- Highcharts display label for pie chart using html table as data source
- Adding multiple series to the spline chart using dotnet high charts in asp.net mvc3
- Gradient fill for guage - Highcharts
- Areat Chart multi lines gradient colors
- Wanted to plot only one spline at the chart load and further add other splines after loading
- my highchart is currently is not working with pie spline chart in updating after rendering chart
More Query from same tag
- Highchart to show progress percentages in horizontal bars with real time data?
- Pass a textfield value from php to javascript
- Use Highchart context menu provided in version v4.0.0
- inner radius polar Highcharter
- highcharts- php/mysql data fetch
- start at the same hour every day
- Highcharts - svg vs digital
- Highcharts map chart not drawing bubble on calling setData
- Highcharts - Small column not clickable when covered with a (sp)line serie
- what class is required from bootstrap to size the asp.net chart
- Highchart solid gauge: trigger click on the grey area
- How to display different tooltip formats in series of data in High Chart
- HighCharts JavaScript Error
- PHP Cache external JSON API in local file - not working
- Highchart series style on button click
- No animation when adding data with series.addPoint()
- Highcharts: set 'select' state on a point and maintain it after mouseover?
- Highcharts prevent page on mobile Safari from moving up and down as I scroll horizontally through data points
- Highcharts Local CSV Issues
- Not able to view the last label in xaxis
- How to make Highcharts default pie not show when Angular page loading
- Highcharts export: Unable to export rendered arc colors
- Hight Chart Polar Scatter Plot values on chart and x-axis
- How to create a HighCharts chart in react
- Highcharts xrange styling
- High chart background and other components are not working as usual
- Highcharts remove renderer path
- Timeline / Schedule in highcharts
- Make highchart columns extend to edge
- Highcharts spider chart padding issue