Creating a temperature gradient line chart with Apex Charts. The hotter the temperature value the redder it is, whilst colder means blue.
The colorStops refer to the ramping of the colour change.
The chart config:
let options = { chart: { height: 380, type: "line", foreColor: '#6D6D6D' }, series: [ { name: "Temperature", data: [15, 20, 25, 29, 33, 36, 37, 32, 27, 23] } ], fill: { type: "gradient", gradient: { type: 'vertical', shadeIntensity: 1, opacityFrom: 1, opacityTo: 1, colorStops: [ { offset: 10, color: "#fc440b", opacity: 1 }, { offset: 55, color: "#ffce63", opacity: 1 }, { offset: 90, color: "#0a95f9", opacity: 1 } ] } }, grid: { borderColor: '#6D6D6D' }, stroke: { curve: 'smooth' }, yaxis: { min: 0, max: 45 }, xaxis: { type: 'category', tickAmount: 8, categories: [ ['4 AM'], ['6 AM'], ['8 AM'], ['10 AM'], ['12 PM'], ['2 PM'], ['4 PM'], ['6 PM'], ['8 PM'], ['10 PM'] ], labels: { show: true } } }; let chart = new ApexCharts(document.querySelector("#chart"), options); chart.render();
Html:
<div id="chart"></div>
A drained and empty Kennington reservoir images from a drone in early July 2024. The…
Merrimu Reservoir from drone. Click images to view larger.
Using FTP and PHP to get an array of file details such as size and…
Creating and using Laravel form requests to create cleaner code, separation and reusability for your…
Improving the default Laravel login and register views in such a simple manner but making…
Laravel validation for checking if a field value exists in the database. The validation rule…