Refactor
This commit is contained in:
parent
415b109f23
commit
1a196b78e6
|
@ -2,6 +2,7 @@
|
||||||
import { ApexOptionsBuilder } from "./ApexOptionsBuilder"
|
import { ApexOptionsBuilder } from "./ApexOptionsBuilder"
|
||||||
import ApexChart from "./ApexChart.svelte"
|
import ApexChart from "./ApexChart.svelte"
|
||||||
import { get } from "lodash";
|
import { get } from "lodash";
|
||||||
|
import formatters from "./formatters"
|
||||||
|
|
||||||
export let title
|
export let title
|
||||||
export let dataProvider
|
export let dataProvider
|
||||||
|
@ -24,13 +25,6 @@
|
||||||
export let stacked
|
export let stacked
|
||||||
export let gradient
|
export let gradient
|
||||||
|
|
||||||
const formatters = {
|
|
||||||
["Default"]: val => val,
|
|
||||||
["Thousands"]: val => `${Math.round(val / 1000)}K`,
|
|
||||||
["Millions"]: val => `${Math.round(val / 1000000)}M`,
|
|
||||||
["Datetime"]: val => (new Date(val)).toLocaleString()
|
|
||||||
}
|
|
||||||
|
|
||||||
$: series = getSeries(dataProvider, valueColumns)
|
$: series = getSeries(dataProvider, valueColumns)
|
||||||
$: categories = getCategories(dataProvider, labelColumn);
|
$: categories = getCategories(dataProvider, labelColumn);
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import { ApexOptionsBuilder } from "./ApexOptionsBuilder"
|
import { ApexOptionsBuilder } from "./ApexOptionsBuilder"
|
||||||
import ApexChart from "./ApexChart.svelte"
|
import ApexChart from "./ApexChart.svelte"
|
||||||
import { get } from "lodash";
|
import { get } from "lodash";
|
||||||
|
import formatters from "./formatters"
|
||||||
|
|
||||||
export let dataProvider
|
export let dataProvider
|
||||||
export let labelColumn
|
export let labelColumn
|
||||||
|
@ -21,13 +22,6 @@
|
||||||
export let c1, c2, c3, c4, c5
|
export let c1, c2, c3, c4, c5
|
||||||
export let horizontal
|
export let horizontal
|
||||||
|
|
||||||
const formatters = {
|
|
||||||
["Default"]: val => val,
|
|
||||||
["Thousands"]: val => `${Math.round(val / 1000)}K`,
|
|
||||||
["Millions"]: val => `${Math.round(val / 1000000)}M`,
|
|
||||||
["Datetime"]: val => (new Date(val)).toLocaleString()
|
|
||||||
}
|
|
||||||
|
|
||||||
$: series = getSeries(dataProvider, valueColumns)
|
$: series = getSeries(dataProvider, valueColumns)
|
||||||
$: categories = getCategories(dataProvider, labelColumn);
|
$: categories = getCategories(dataProvider, labelColumn);
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import { ApexOptionsBuilder } from "./ApexOptionsBuilder"
|
import { ApexOptionsBuilder } from "./ApexOptionsBuilder"
|
||||||
import ApexChart from "./ApexChart.svelte"
|
import ApexChart from "./ApexChart.svelte"
|
||||||
import { get } from "lodash";
|
import { get } from "lodash";
|
||||||
|
import formatters from "./formatters"
|
||||||
|
|
||||||
export let title
|
export let title
|
||||||
export let dataProvider
|
export let dataProvider
|
||||||
|
@ -19,13 +20,6 @@
|
||||||
export let palette
|
export let palette
|
||||||
export let c1, c2, c3, c4, c5
|
export let c1, c2, c3, c4, c5
|
||||||
|
|
||||||
const formatters = {
|
|
||||||
["Default"]: val => val,
|
|
||||||
["Thousands"]: val => `${Math.round(val / 1000)}K`,
|
|
||||||
["Millions"]: val => `${Math.round(val / 1000000)}M`,
|
|
||||||
["Datetime"]: val => (new Date(val)).toLocaleString()
|
|
||||||
}
|
|
||||||
|
|
||||||
$: series = getSeries(dataProvider, valueColumns)
|
$: series = getSeries(dataProvider, valueColumns)
|
||||||
$: categories = getCategories(dataProvider, labelColumn);
|
$: categories = getCategories(dataProvider, labelColumn);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue