Time series color

This commit is contained in:
Ben Haynes
2021-05-29 18:07:00 -04:00
parent 29ccd2d013
commit 7971a1d11e
2 changed files with 15 additions and 3 deletions

View File

@@ -88,6 +88,15 @@ export default definePanel({
width: 'half',
},
},
{
field: 'color',
name: '$t:color',
type: 'string',
meta: {
interface: 'select-color',
width: 'half',
},
},
],
minWidth: 16,
minHeight: 8,

View File

@@ -13,6 +13,7 @@ type TimeSeriesOptions = {
valueField: string;
function: 'avg' | 'sum' | 'min' | 'max' | 'count';
limit: number;
color: string;
};
export default defineComponent({
@@ -37,9 +38,11 @@ export default defineComponent({
fetchData();
console.log(props.options.color + "test");
onMounted(() => {
chart.value = new ApexCharts(chartEl.value, {
colors: ['var(--primary)'],
colors: [(props.options.color ? props.options.color : 'var(--primary)')],
chart: {
type: 'area',
height: '100%',
@@ -68,12 +71,12 @@ export default defineComponent({
[
{
offset: 0,
color: 'var(--primary)',
color: (props.options.color ? props.options.color : 'var(--primary)'),
opacity: 0.25,
},
{
offset: 100,
color: 'var(--primary)',
color: (props.options.color ? props.options.color : 'var(--primary)'),
opacity: 0,
},
],