Javascript examples for highcharts:Chart Color
line chart with gradient color under line
<html> <head> <title>Highcharts Demo</title> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script> <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/modules/exporting.js"></script> <script src="https://code.highcharts.com/modules/export-data.js"></script> <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div> <script type="text/javascript"> var data = [//w w w . ja v a 2 s .c o m {"StartTime":"2018-06-11T00:00:00","TotalReq":10}, {"StartTime":"2018-06-12T00:00:00","TotalReq":34}, {"StartTime":"2018-06-15T00:00:00","TotalReq":31}, {"StartTime":"2018-06-16T00:00:00","TotalReq":2}, {"StartTime":"2018-06-18T00:00:00","TotalReq":38}, {"StartTime":"2018-06-19T00:00:00","TotalReq":69}, {"StartTime":"2018-06-20T00:00:00","TotalReq":39}, {"StartTime":"2018-06-21T00:00:00","TotalReq":100}, {"StartTime":"2018-06-22T00:00:00","TotalReq":180}, {"StartTime":"2018-06-25T00:00:00","TotalReq":104}, {"StartTime":"2018-06-26T00:00:00","TotalReq":101}, {"StartTime":"2018-06-27T00:00:00","TotalReq":123} ].map(function(data) { return {x: new Date(data.StartTime).getTime(), y: data.TotalReq }}) Highcharts.chart('container', { chart: { zoomType: 'x' }, title: { text: 'USD to EUR exchange rate over time' }, subtitle: { text: document.ontouchstart === undefined ? 'Click and drag in the plot area to zoom in' : 'Pinch the chart to zoom in' }, xAxis: { type: 'datetime' }, yAxis: { title: { text: 'Exchange rate' } }, legend: { enabled: false }, plotOptions: { area: { fillColor: { linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, stops: [ [0, Highcharts.getOptions().colors[0]], [1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')] ] }, marker: { radius: 2 }, lineWidth: 1, states: { hover: { lineWidth: 1 } }, threshold: null } }, series: [{ type: 'area', name: 'USD to EUR', data: data }] } ); </script> </body> </html>