score:6
The difficulty is the granularity: Highcharts draws one single SVG path for the series' points, and associates that one path with the gradient. If your series data is relatively linear however, the following approximation might be useful. See the jsfiddle that I've created:
Assuming that your series data is not static, my demo includes two series and a function that, for each series, attempts to dynamically create the linearGradient that comes closest to your requirement:
function getLinearGradient(series) {
var lastY0=null, lastY1=null, maxY0=null, maxY1=null;
$.each(series.data, function(key,value) {
maxY0 = Math.max(value[1],maxY0);
maxY1 = Math.max(value[2],maxY1);
lastY0 = value[1];
lastY1 = value[2];
});
var firstY0 = series.data[0][2],
firstY1 = series.data[0][2]
;
var minY0=maxY0, minY1=maxY1;
$.each(series.data, function(key,value) {
minY0 = Math.min(value[1],minY0);
minY1 = Math.min(value[2],minY1);
});
var minY = minY0,
maxY = maxY1,
heightY = maxY - minY
;
var gradient = {
x1: 10 + ( ((firstY0-minY) / heightY) * 80 ) + "%",
y1: "10%",
x2: 10 + ( ((lastY1-minY) / heightY) * 80 ) + "%",
y2: "90%"
};
return gradient;
};
Of course, this approach is not a full-blown solution and only useful if you're dealing with data that approximately follows a linear curve. Here's the jsfiddle
score:2
I don't have any example, nor do I know for sure if it is already in the specifications, but I am pretty sure the only way to accomplish this effect would be using svg mash gradients.
You could use the path points as boundary points for the mash matrix and get the effect you want.
See here for further information.
Source: stackoverflow.com
Related Query
- Highchart Area Range chart with gradient that follows the line
- Vertical areas along with line on the chart - is that possible
- Highchart Line chart – data series with multiple axis - 2nd series placed in the middle of X axis
- Html5 line chart with a different color when out of area range
- Highchart Combination Chart Area Range not displaying on chart but line chart works
- Highcharts to display area range and line chart with data from a CSV file
- How to create area range with line highchart
- Highcharts - Scatter chart with a line connecting the dots in the series
- Highchart - line or area not starting at the left point
- Creating 0-50-100 percentile area line graphs that use 50 as the threshold for negative
- Highcharts column + line combination chart with multiple series. Issue aligning line over the column
- Highcharts change the line color if its out of the area range
- combining an area chart with a line chart in highcharts.js
- HighChart Sparkline Chart with dynamic data for the table
- Highchart not displaying the pie chart with Ajax data
- Chart data of object gets overwritten, but only the first object that is interacted with is affected
- Remove line dots from the area spline chart
- Highchart line chart with category do not occupy full width
- how do i redraw only the Highchart with new API that depends on my Select Option Parameter?
- highchart line chart last null value is not conected with line
- Issue with Spider HighChart as it is showing as a line chart sometimes
- highcharts - Draw horizontal line outside the chart area
- High Charts - area chart with gradient & threshold
- highchart's line chart with constant series not plotting when using linear gradient colour
- In highcharts, is it possible to make a bar in a column chart with its top bordering the edge of the chart area "on top" of the chart border?
- Adding area gradient to line highchart
- Is it possible to trigger tooltip in highchart of a line chart ONLY when the mouse hovers over the point?
- How to make the highchart fully occupied with the div that had set?
- Using an editable table with HighChart and having the chart refresh with change
- Adding space between the line and the fill in a Highcharts area chart
More Query from same tag
- How to change the background series colour of Highcharts Radar chart
- HighStock chart.rangeSelector after loading
- The empty space on the chart xaxis
- highcharts-react Gantt: get mouse coordinates from mouse-over
- Highcharts - series.remove(); 4 series in chart, only 2 removed
- Responsive behaviour for ng-highcharts with compiled ng-click on xAxis labels hidden on load
- Don't connect points with value 0 in highcharts
- Erb array not updated after ajax post
- Setting Flag on Click Event for Candlestick Chart
- HighStock change tickPositions for Axis dynamically
- Highcharts line chart tooltips not showing correctly?
- Highcharts align data label to x-axis if value is negative
- Min/Max on x-axis not honored in Highstocks version of xrange chart
- how to have a chart with no spline and no interpolation in Highcharts?
- Highchart formatter function executed twice every time
- Highcharts: detect if tooltip is being shown
- Using an editable table with HighChart and having the chart refresh with change
- Highcharts: xAxis yearly labels centered between ticks
- Highchart dual layer donut slide both the inner and outer donuts together
- xAxis tickInterval throwing error in fullscreen
- How can I highlight selected label in HIghcharts Timeline?
- Graphs backround on Iexplorer after Deploying it on the server
- X-Axis date fromatting in highcharts
- legend size in Highcharts under ruby on rails
- Set left and right border-like on highchart
- canvas image gets blurry
- How can I build a hashed region for null column values in Highcharts?
- Highchart is not resizing dynamically when used as a angular directive
- Change colors on data points
- Change Style of Title in HighCharts in ActionResult