-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
14 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,10 @@ | |
/* !include https://cdn.jsdelivr.net/npm/[email protected]/dist/apexcharts.min.js */ | ||
|
||
function sqlpage_chart() { | ||
|
||
const tblrColors = Object.fromEntries(['azure', 'red', 'lime', 'blue', 'pink', 'indigo', 'purple', 'yellow', 'cyan', 'green', 'orange', 'cyan'] | ||
.map(c => [c, getComputedStyle(document.documentElement).getPropertyValue('--tblr-' + c)])); | ||
|
||
/** @typedef { { [name:string]: {data:{x:number,y:number}[], name:string} } } Series */ | ||
|
||
/** | ||
|
@@ -43,6 +47,11 @@ function sqlpage_chart() { | |
if (data.ymin == null) data.ymin = 0; | ||
if (data.ymax == null) data.ymax = undefined; | ||
|
||
const colors = [ | ||
...data.colors.filter(c => c).map(c => tblrColors[c]), | ||
...Object.values(tblrColors) | ||
]; | ||
|
||
let series = Object.values(series_map); | ||
|
||
// tickamount is the number of intervals, not the number of ticks | ||
|
@@ -80,7 +89,6 @@ function sqlpage_chart() { | |
enabled: !!data.labels, | ||
}, | ||
fill: { | ||
opacity: .7, | ||
type: data.type === 'area' ? 'gradient' : 'solid', | ||
}, | ||
stroke: { | ||
|
@@ -115,6 +123,10 @@ function sqlpage_chart() { | |
sizeOffset: 5, | ||
} | ||
}, | ||
tooltip: { | ||
fillSeriesColor: false, | ||
}, | ||
colors, | ||
series, | ||
}; | ||
if (labels) options.labels = labels; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters