From ab78620b32390b7a243069385c4a43c2de8d1302 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 2 Nov 2020 15:32:37 +0000 Subject: [PATCH] Add bar chart with initial apex charts config --- .../userInterface/temporaryPanelStructure.js | 800 +++++++++--------- packages/standard-components/components.json | 31 +- packages/standard-components/package.json | 9 +- .../src/Chart/ApexOptionsBuilder.js | 69 ++ .../standard-components/src/Chart/Bar.svelte | 217 +---- .../src/Chart/Brush.svelte | 118 --- .../src/Chart/Bullet.svelte | 103 --- .../src/Chart/Chart.svelte | 169 ---- .../src/Chart/Donut.svelte | 213 ----- .../src/Chart/GroupedBar.svelte | 145 ---- .../src/Chart/Heatmap.svelte | 83 -- .../src/Chart/Legend.svelte | 86 -- .../standard-components/src/Chart/Line.svelte | 256 ------ .../src/Chart/ScatterPlot.svelte | 187 ---- .../src/Chart/Sparkline.svelte | 103 --- .../src/Chart/StackedArea.svelte | 181 ---- .../src/Chart/StackedBar.svelte | 176 ---- .../standard-components/src/Chart/Step.svelte | 129 --- .../standard-components/src/Chart/Temp.svelte | 41 - .../src/Chart/Tooltip.svelte | 81 -- .../standard-components/src/Chart/index.js | 12 - .../src/Chart/tests/bar.html | 72 -- .../src/Chart/tests/line.html | 235 ----- .../standard-components/src/Chart/utils.js | 41 - .../standard-components/src/DataChart.svelte | 49 -- packages/standard-components/src/index.js | 4 +- 26 files changed, 518 insertions(+), 3092 deletions(-) create mode 100644 packages/standard-components/src/Chart/ApexOptionsBuilder.js delete mode 100644 packages/standard-components/src/Chart/Brush.svelte delete mode 100644 packages/standard-components/src/Chart/Bullet.svelte delete mode 100644 packages/standard-components/src/Chart/Chart.svelte delete mode 100644 packages/standard-components/src/Chart/Donut.svelte delete mode 100644 packages/standard-components/src/Chart/GroupedBar.svelte delete mode 100644 packages/standard-components/src/Chart/Heatmap.svelte delete mode 100644 packages/standard-components/src/Chart/Legend.svelte delete mode 100644 packages/standard-components/src/Chart/Line.svelte delete mode 100644 packages/standard-components/src/Chart/ScatterPlot.svelte delete mode 100644 packages/standard-components/src/Chart/Sparkline.svelte delete mode 100644 packages/standard-components/src/Chart/StackedArea.svelte delete mode 100644 packages/standard-components/src/Chart/StackedBar.svelte delete mode 100644 packages/standard-components/src/Chart/Step.svelte delete mode 100644 packages/standard-components/src/Chart/Temp.svelte delete mode 100644 packages/standard-components/src/Chart/Tooltip.svelte delete mode 100644 packages/standard-components/src/Chart/tests/bar.html delete mode 100644 packages/standard-components/src/Chart/tests/line.html delete mode 100644 packages/standard-components/src/Chart/utils.js delete mode 100644 packages/standard-components/src/DataChart.svelte diff --git a/packages/builder/src/components/userInterface/temporaryPanelStructure.js b/packages/builder/src/components/userInterface/temporaryPanelStructure.js index 1c4bc632a6..2c8c50a0cb 100644 --- a/packages/builder/src/components/userInterface/temporaryPanelStructure.js +++ b/packages/builder/src/components/userInterface/temporaryPanelStructure.js @@ -422,100 +422,100 @@ export default { icon: "ri-bar-chart-2-line", isCategory: true, children: [ - { - name: "Donut", - _component: "@budibase/standard-components/donut", - description: "Donut chart", - icon: "ri-pie-chart-fill", - properties: { - settings: [ - { - label: "Data", - key: "datasource", - control: TableViewSelect, - }, - { - label: "Name Field", - key: "nameKey", - dependsOn: "datasource", - control: TableViewFieldSelect, - }, - { - label: "Value Field", - key: "valueKey", - dependsOn: "datasource", - control: TableViewFieldSelect, - }, - { - label: "Animate Chart", - key: "isAnimated", - valueKey: "checked", - control: Checkbox, - }, - { - label: "Hover Highlight", - key: "hasHoverAnimation", - valueKey: "checked", - control: Checkbox, - }, - { - label: "Keep Last Hover", - key: "hasLastHoverSliceHighlighted", - valueKey: "checked", - control: Checkbox, - }, - { - label: "Colors", - key: "color", - control: OptionSelect, - options: [ - "britecharts", - "blueGreen", - "green", - "grey", - "orange", - "pink", - "purple", - "red", - "teal", - "yellow", - ], - }, - { - label: "External Radius", - key: "externalRadius", - control: Input, - }, - { - label: "Internal Radius", - key: "internalRadius", - control: Input, - }, - { - label: "Radius Offset", - key: "radiusHoverOffset ", - control: Input, - }, - { - label: "Show Legend", - key: "useLegend ", - valueKey: "checked", - control: Checkbox, - }, - { - label: "Horizontal Legend", - key: "horizontalLegend", - valueKey: "checked", - control: Checkbox, - }, - { - label: "Legend Width", - key: "legendWidth", - control: Input, - }, - ], - }, - }, + // { + // name: "Donut", + // _component: "@budibase/standard-components/donut", + // description: "Donut chart", + // icon: "ri-pie-chart-fill", + // properties: { + // settings: [ + // { + // label: "Data", + // key: "datasource", + // control: TableViewSelect, + // }, + // { + // label: "Name Field", + // key: "nameKey", + // dependsOn: "datasource", + // control: TableViewFieldSelect, + // }, + // { + // label: "Value Field", + // key: "valueKey", + // dependsOn: "datasource", + // control: TableViewFieldSelect, + // }, + // { + // label: "Animate Chart", + // key: "isAnimated", + // valueKey: "checked", + // control: Checkbox, + // }, + // { + // label: "Hover Highlight", + // key: "hasHoverAnimation", + // valueKey: "checked", + // control: Checkbox, + // }, + // { + // label: "Keep Last Hover", + // key: "hasLastHoverSliceHighlighted", + // valueKey: "checked", + // control: Checkbox, + // }, + // { + // label: "Colors", + // key: "color", + // control: OptionSelect, + // options: [ + // "britecharts", + // "blueGreen", + // "green", + // "grey", + // "orange", + // "pink", + // "purple", + // "red", + // "teal", + // "yellow", + // ], + // }, + // { + // label: "External Radius", + // key: "externalRadius", + // control: Input, + // }, + // { + // label: "Internal Radius", + // key: "internalRadius", + // control: Input, + // }, + // { + // label: "Radius Offset", + // key: "radiusHoverOffset ", + // control: Input, + // }, + // { + // label: "Show Legend", + // key: "useLegend ", + // valueKey: "checked", + // control: Checkbox, + // }, + // { + // label: "Horizontal Legend", + // key: "horizontalLegend", + // valueKey: "checked", + // control: Checkbox, + // }, + // { + // label: "Legend Width", + // key: "legendWidth", + // control: Input, + // }, + // ], + // }, + // }, { name: "Bar", _component: "@budibase/standard-components/bar", @@ -529,13 +529,13 @@ export default { control: TableViewSelect, }, { - label: "Name Label", + label: "Label Col.", key: "nameLabel", dependsOn: "datasource", control: TableViewFieldSelect, }, { - label: "Value Label", + label: "Value Col.", key: "valueLabel", dependsOn: "datasource", control: TableViewFieldSelect, @@ -550,291 +550,11 @@ export default { key: "xAxisLabel", control: Input, }, - { - label: "X Axis Label Offset", - key: "xAxisLabelOffset", - control: Input, - }, - { - label: "Y Axis Label Offset", - key: "yAxisLabelOffset", - control: Input, - }, - { - label: "Enable Labels", - key: "enableLabels", - control: Checkbox, - valueKey: "checked", - }, - { - label: "Colors", - key: "color", - control: OptionSelect, - options: [ - { label: "Normal", value: "britecharts" }, - { label: "Blue Green", value: "blueGreen" }, - { label: "Green", value: "green" }, - { label: "Grey", value: "grey" }, - { label: "Orange", value: "orange" }, - { label: "Pink", value: "pink" }, - { label: "Purple", value: "purple" }, - { label: "Red", value: "red" }, - { label: "Teal", value: "teal" }, - { label: "Yellow", value: "yellow" }, - ], - }, - { - label: "Gradients", - key: "gradient", - control: OptionSelect, - options: [ - { value: "", label: "None" }, - { value: "bluePurple", label: "Blue Purple" }, - { value: "greenBlue", label: "Green Blue" }, - { value: "orangePink", label: "Orange Pink" }, - ], - }, - { - label: "Highlight Single Bar", - key: "hasSingleBarHighlight", - control: Checkbox, - valueKey: "checked", - }, - { - label: "Width", - key: "width", - control: Input, - }, - { - label: "Height", - key: "height", - control: Input, - }, - { - label: "Animate", - key: "isAnimate", - control: Checkbox, - valueKey: "checked", - }, - { - label: "Horizontal", - key: "isHorizontal", - control: Checkbox, - valueKey: "checked", - }, - { - label: "Label Number Format", - key: "labelsNumberFormat", - control: Input, - }, - ], - }, - }, - { - name: "Grouped Bar", - _component: "@budibase/standard-components/groupedbar", - description: "Groupedbar chart", - icon: "ri-bar-chart-grouped-fill", - properties: { - settings: [ - { - label: "Data", - key: "datasource", - control: TableViewSelect, - }, - { - label: "Name Label", - key: "nameLabel", - dependsOn: "datasource", - control: TableViewFieldSelect, - }, - { - label: "Group Label", - key: "groupLabel", - dependsOn: "datasource", - control: TableViewFieldSelect, - }, - { - label: "Value Label", - key: "valueLabel", - dependsOn: "datasource", - control: TableViewFieldSelect, - }, { label: "Color", key: "color", - control: OptionSelect, - options: [ - "britecharts", - "blueGreen", - "green", - "grey", - "orange", - "pink", - "purple", - "red", - "teal", - "yellow", - ], - }, - { - label: "Height", - key: "height", - control: Input, - }, - { - label: "Width", - key: "width", - control: Input, - }, - { - label: "Aspect Ratio", - key: "aspectRatio", - control: Input, - }, - { - label: "Grid", - key: "grid", - control: OptionSelect, - options: ["vertical", "horizontal", "full"], - }, - { - label: "Value Label", - key: "valueLabel", - control: Input, - }, - { - label: "Y Ticks", - key: "yTicks", - control: Input, - }, - { - label: "Y Tick Text Offset", - key: "yTickTextOffset", - control: Input, - }, - { - label: "Is Animated", - key: "isAnimated", - valueKey: "checked", - control: Checkbox, - }, - { - label: "Is Horizontal", - key: "isHorizontal", - valueKey: "checked", - control: Checkbox, - }, - { - label: "Tooltip Title", - key: "tooltipTitle", - control: Input, - }, - ], - }, - }, - { - name: "Line", - _component: "@budibase/standard-components/line", - description: "Line chart", - icon: "ri-line-chart-line", - properties: { - settings: [ - { - label: "Data", - key: "datasource", - control: TableViewSelect, - }, - { - label: "Value Label", - key: "valueLabel", - dependsOn: "datasource", - control: TableViewFieldSelect, - }, - { - label: "Topic Label", - key: "topicLabel", - dependsOn: "datasource", - control: TableViewFieldSelect, - }, - { - label: "Date Label", - key: "dateLabel", - dependsOn: "datasource", - control: TableViewFieldSelect, - }, - { - label: "Colors", - key: "color", - control: OptionSelect, - options: [ - "britecharts", - "blueGreen", - "green", - "grey", - "orange", - "pink", - "purple", - "red", - "teal", - "yellow", - ], - }, - { - label: "Gradients", - key: "lineGradient", - control: OptionSelect, - options: [ - { value: "", label: "None" }, - { value: "bluePurple", label: "Blue Purple" }, - { value: "greenBlue", label: "Green Blue" }, - { value: "orangePink", label: "Orange Pink" }, - ], - }, - { - label: "Line Curve", - key: "lineCurve", - control: OptionSelect, - options: [ - "linear", - "basis", - "natural", - "monotoneX", - "monotoneY", - "step", - "stepAfter", - "stepBefore", - "cardinal", - "catmullRom", - ], - }, - { - label: "X Axis Value Type", - key: "xAxisValueType", - control: OptionSelect, - options: ["date", "number"], - }, - { - label: "Grid", - key: "grid", - control: OptionSelect, - options: ["vertical", "horizontal", "full"], - }, - { - label: "X Axis Label", - key: "xAxisLabel", - control: Input, - }, - { - label: "Y Axis Label", - key: "yAxisLabel", - control: Input, - }, - { - label: "Show All Datapoints", - key: "shouldShowAllDataPoints", - valueKey: "checked", - control: Checkbox, + control: Colorpicker, + defaultValue: "#4285f4", }, { label: "Width", @@ -845,60 +565,300 @@ export default { label: "Height", key: "height", control: Input, + defaultValue: "400", }, { - label: "Is Animated", - key: "isAnimated", + label: "Horizontal", + key: "horizontal", control: Checkbox, valueKey: "checked", }, { - label: "Locale", - key: "locale", - control: OptionSelect, - options: ["en-GB", "en-US"], + label: "Data Labels", + key: "dataLabels", + control: Checkbox, + valueKey: "checked", + defaultValue: true, }, { - label: "X Axis Value Type", - key: "xAxisValueType", - control: OptionSelect, - options: ["date", "numeric"], - }, - { - label: "X Axis Format", - key: "xAxisFormat", - control: OptionSelect, - options: [ - "day-month", - "minute-hour", - "hour-daymonth", - "month-year", - "custom", - ], - }, - { - label: "X Axis Custom Format", - key: "xAxisCustomFormat", - control: Input, - }, - { - label: "Tooltip Title", - key: "tooltipTitle", - control: Input, - }, - { - label: "X Ticks", - key: "xTicks", - control: Input, - }, - { - label: "Y Ticks", - key: "yTicks", - control: Input, + label: "Animate", + key: "animate", + control: Checkbox, + valueKey: "checked", + defaultValue: true, }, ], }, }, + // { + // name: "Grouped Bar", + // _component: "@budibase/standard-components/groupedbar", + // description: "Groupedbar chart", + // icon: "ri-bar-chart-grouped-fill", + // properties: { + // settings: [ + // { + // label: "Data", + // key: "datasource", + // control: TableViewSelect, + // }, + // { + // label: "Name Label", + // key: "nameLabel", + // dependsOn: "datasource", + // control: TableViewFieldSelect, + // }, + // { + // label: "Group Label", + // key: "groupLabel", + // dependsOn: "datasource", + // control: TableViewFieldSelect, + // }, + // { + // label: "Value Label", + // key: "valueLabel", + // dependsOn: "datasource", + // control: TableViewFieldSelect, + // }, + // { + // label: "Color", + // key: "color", + // control: OptionSelect, + // options: [ + // "britecharts", + // "blueGreen", + // "green", + // "grey", + // "orange", + // "pink", + // "purple", + // "red", + // "teal", + // "yellow", + // ], + // }, + // { + // label: "Height", + // key: "height", + // control: Input, + // }, + // { + // label: "Width", + // key: "width", + // control: Input, + // }, + // { + // label: "Aspect Ratio", + // key: "aspectRatio", + // control: Input, + // }, + // { + // label: "Grid", + // key: "grid", + // control: OptionSelect, + // options: ["vertical", "horizontal", "full"], + // }, + // { + // label: "Value Label", + // key: "valueLabel", + // control: Input, + // }, + // { + // label: "Y Ticks", + // key: "yTicks", + // control: Input, + // }, + // { + // label: "Y Tick Text Offset", + // key: "yTickTextOffset", + // control: Input, + // }, + // { + // label: "Is Animated", + // key: "isAnimated", + // valueKey: "checked", + // control: Checkbox, + // }, + // { + // label: "Is Horizontal", + // key: "isHorizontal", + // valueKey: "checked", + // control: Checkbox, + // }, + // { + // label: "Tooltip Title", + // key: "tooltipTitle", + // control: Input, + // }, + // ], + // }, + // }, + // { + // name: "Line", + // _component: "@budibase/standard-components/line", + // description: "Line chart", + // icon: "ri-line-chart-line", + // properties: { + // settings: [ + // { + // label: "Data", + // key: "datasource", + // control: TableViewSelect, + // }, + // { + // label: "Value Label", + // key: "valueLabel", + // dependsOn: "datasource", + // control: TableViewFieldSelect, + // }, + // { + // label: "Topic Label", + // key: "topicLabel", + // dependsOn: "datasource", + // control: TableViewFieldSelect, + // }, + // { + // label: "Date Label", + // key: "dateLabel", + // dependsOn: "datasource", + // control: TableViewFieldSelect, + // }, + // { + // label: "Colors", + // key: "color", + // control: OptionSelect, + // options: [ + // "britecharts", + // "blueGreen", + // "green", + // "grey", + // "orange", + // "pink", + // "purple", + // "red", + // "teal", + // "yellow", + // ], + // }, + // { + // label: "Gradients", + // key: "lineGradient", + // control: OptionSelect, + // options: [ + // { value: "", label: "None" }, + // { value: "bluePurple", label: "Blue Purple" }, + // { value: "greenBlue", label: "Green Blue" }, + // { value: "orangePink", label: "Orange Pink" }, + // ], + // }, + // { + // label: "Line Curve", + // key: "lineCurve", + // control: OptionSelect, + // options: [ + // "linear", + // "basis", + // "natural", + // "monotoneX", + // "monotoneY", + // "step", + // "stepAfter", + // "stepBefore", + // "cardinal", + // "catmullRom", + // ], + // }, + // { + // label: "X Axis Value Type", + // key: "xAxisValueType", + // control: OptionSelect, + // options: ["date", "number"], + // }, + // { + // label: "Grid", + // key: "grid", + // control: OptionSelect, + // options: ["vertical", "horizontal", "full"], + // }, + // { + // label: "X Axis Label", + // key: "xAxisLabel", + // control: Input, + // }, + // { + // label: "Y Axis Label", + // key: "yAxisLabel", + // control: Input, + // }, + // { + // label: "Show All Datapoints", + // key: "shouldShowAllDataPoints", + // valueKey: "checked", + // control: Checkbox, + // }, + // { + // label: "Width", + // key: "width", + // control: Input, + // }, + // { + // label: "Height", + // key: "height", + // control: Input, + // }, + // { + // label: "Is Animated", + // key: "isAnimated", + // control: Checkbox, + // valueKey: "checked", + // }, + // { + // label: "Locale", + // key: "locale", + // control: OptionSelect, + // options: ["en-GB", "en-US"], + // }, + // { + // label: "X Axis Value Type", + // key: "xAxisValueType", + // control: OptionSelect, + // options: ["date", "numeric"], + // }, + // { + // label: "X Axis Format", + // key: "xAxisFormat", + // control: OptionSelect, + // options: [ + // "day-month", + // "minute-hour", + // "hour-daymonth", + // "month-year", + // "custom", + // ], + // }, + // { + // label: "X Axis Custom Format", + // key: "xAxisCustomFormat", + // control: Input, + // }, + // { + // label: "Tooltip Title", + // key: "tooltipTitle", + // control: Input, + // }, + // { + // label: "X Ticks", + // key: "xTicks", + // control: Input, + // }, + // { + // label: "Y Ticks", + // key: "yTicks", + // control: Input, + // }, + // ], + // }, + // }, ], }, { diff --git a/packages/standard-components/components.json b/packages/standard-components/components.json index 9adb3c02cf..f63ce9d56b 100644 --- a/packages/standard-components/components.json +++ b/packages/standard-components/components.json @@ -552,21 +552,26 @@ "datasource": "tables", "nameLabel": "string", "valueLabel": "string", - "betweenBarsPadding": "number", - "gradient": "string", - "color": "string", - "hasSingleBarHighlight": "bool", - "height": "number", + "color": { + "type": "string", + "default": "#4285f4" + }, + "height": { + "type": "number", + "default": "400" + }, "width": "number", - "isAnimated": "bool", - "isHorizontal": "bool", - "labelNumberFormat": "number", - "locale": "string", + "horizontal": "bool", + "dataLabels": { + "type": "bool", + "default": true + }, + "animate": { + "type": "bool", + "default": true + }, "xAxisLabel": "string", - "yAxisLabel": "string", - "useLegend": "bool", - "xTicks": "number", - "yTicks": "number" + "yAxisLabel": "string" } }, "line": { diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index 9b2fca0f54..720d704618 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -35,18 +35,15 @@ "license": "MIT", "gitHead": "284cceb9b703c38566c6e6363c022f79a08d5691", "dependencies": { - "@beyonk/svelte-googlemaps": "^2.2.0", "@budibase/bbui": "^1.50.1", "@budibase/svelte-ag-grid": "^0.0.13", "@fortawesome/fontawesome-free": "^5.14.0", "@svelteschool/svelte-forms": "^0.7.0", - "britecharts": "^2.16.1", - "d3-selection": "^1.4.2", + "apexcharts": "^3.22.1", "fast-sort": "^2.2.0", "flatpickr": "^4.6.6", - "fusioncharts": "^3.15.1-sr.1", "lodash.debounce": "^4.0.8", - "svelte-flatpickr": "^3.1.0", - "svelte-fusioncharts": "^1.0.0" + "svelte-apexcharts": "^1.0.2", + "svelte-flatpickr": "^3.1.0" } } diff --git a/packages/standard-components/src/Chart/ApexOptionsBuilder.js b/packages/standard-components/src/Chart/ApexOptionsBuilder.js new file mode 100644 index 0000000000..4fb66e90f6 --- /dev/null +++ b/packages/standard-components/src/Chart/ApexOptionsBuilder.js @@ -0,0 +1,69 @@ +export class ApexOptionsBuilder { + options = { + series: [], + } + + setOption(path, value) { + if (value == null || value === "") { + return this + } + let tmp = this.options + for (let i = 0; i < path.length - 1; i++) { + const step = path[i] + if (!tmp[step]) { + tmp[step] = {} + } + tmp = tmp[step] + } + tmp[path[path.length - 1]] = value + return this + } + + getOptions() { + return this.options + } + + type(type) { + return this.setOption(["chart", "type"], type) + } + + color(color) { + return this.setOption(["colors"], color) + } + + width(width) { + return this.setOption(["chart", "width"], width || undefined) + } + + height(height) { + return this.setOption(["chart", "height"], height || undefined) + } + + xLabel(label) { + return this.setOption(["xaxis", "title", "text"], label) + } + + yLabel(label) { + return this.setOption(["yaxis", "title", "text"], label) + } + + categories(categories) { + return this.setOption(["xaxis", "categories"], categories) + } + + series(series) { + return this.setOption(["series"], series) + } + + horizontal(horizontal) { + return this.setOption(["plotOptions", "bar", "horizontal"], horizontal) + } + + dataLabels(dataLabels) { + return this.setOption(["dataLabels", "enabled"], dataLabels) + } + + animate(animate) { + return this.setOption(["chart", "animations", "enabled"], animate) + } +} diff --git a/packages/standard-components/src/Chart/Bar.svelte b/packages/standard-components/src/Chart/Bar.svelte index 24da930e14..d73a0681a3 100644 --- a/packages/standard-components/src/Chart/Bar.svelte +++ b/packages/standard-components/src/Chart/Bar.svelte @@ -1,187 +1,64 @@ -
+
diff --git a/packages/standard-components/src/Chart/Brush.svelte b/packages/standard-components/src/Chart/Brush.svelte deleted file mode 100644 index d1e736074b..0000000000 --- a/packages/standard-components/src/Chart/Brush.svelte +++ /dev/null @@ -1,118 +0,0 @@ - - -
diff --git a/packages/standard-components/src/Chart/Bullet.svelte b/packages/standard-components/src/Chart/Bullet.svelte deleted file mode 100644 index 04f3ef1648..0000000000 --- a/packages/standard-components/src/Chart/Bullet.svelte +++ /dev/null @@ -1,103 +0,0 @@ - - -
diff --git a/packages/standard-components/src/Chart/Chart.svelte b/packages/standard-components/src/Chart/Chart.svelte deleted file mode 100644 index 3f1634719a..0000000000 --- a/packages/standard-components/src/Chart/Chart.svelte +++ /dev/null @@ -1,169 +0,0 @@ - - - - -
-{#if useLegend} -
-{/if} diff --git a/packages/standard-components/src/Chart/Donut.svelte b/packages/standard-components/src/Chart/Donut.svelte deleted file mode 100644 index 89b314e3db..0000000000 --- a/packages/standard-components/src/Chart/Donut.svelte +++ /dev/null @@ -1,213 +0,0 @@ - - -
-
- {#if data.length > 0} - - {/if} -
diff --git a/packages/standard-components/src/Chart/GroupedBar.svelte b/packages/standard-components/src/Chart/GroupedBar.svelte deleted file mode 100644 index 3f95a778c8..0000000000 --- a/packages/standard-components/src/Chart/GroupedBar.svelte +++ /dev/null @@ -1,145 +0,0 @@ - - -
diff --git a/packages/standard-components/src/Chart/Heatmap.svelte b/packages/standard-components/src/Chart/Heatmap.svelte deleted file mode 100644 index 9d2eb8d878..0000000000 --- a/packages/standard-components/src/Chart/Heatmap.svelte +++ /dev/null @@ -1,83 +0,0 @@ - - -
-{#if useLegend} -
-{/if} diff --git a/packages/standard-components/src/Chart/Legend.svelte b/packages/standard-components/src/Chart/Legend.svelte deleted file mode 100644 index a5745f25d1..0000000000 --- a/packages/standard-components/src/Chart/Legend.svelte +++ /dev/null @@ -1,86 +0,0 @@ - - -{#if useLegend} -
-{/if} diff --git a/packages/standard-components/src/Chart/Line.svelte b/packages/standard-components/src/Chart/Line.svelte deleted file mode 100644 index b6f5452072..0000000000 --- a/packages/standard-components/src/Chart/Line.svelte +++ /dev/null @@ -1,256 +0,0 @@ - - -
diff --git a/packages/standard-components/src/Chart/ScatterPlot.svelte b/packages/standard-components/src/Chart/ScatterPlot.svelte deleted file mode 100644 index cc775fa6ee..0000000000 --- a/packages/standard-components/src/Chart/ScatterPlot.svelte +++ /dev/null @@ -1,187 +0,0 @@ - - -
-{#if useLegend} -
-{/if} diff --git a/packages/standard-components/src/Chart/Sparkline.svelte b/packages/standard-components/src/Chart/Sparkline.svelte deleted file mode 100644 index 920843a080..0000000000 --- a/packages/standard-components/src/Chart/Sparkline.svelte +++ /dev/null @@ -1,103 +0,0 @@ - - -
-{#if useLegend} -
-{/if} diff --git a/packages/standard-components/src/Chart/StackedArea.svelte b/packages/standard-components/src/Chart/StackedArea.svelte deleted file mode 100644 index 04116c29f6..0000000000 --- a/packages/standard-components/src/Chart/StackedArea.svelte +++ /dev/null @@ -1,181 +0,0 @@ - - -
-{#if useLegend} -
-{/if} diff --git a/packages/standard-components/src/Chart/StackedBar.svelte b/packages/standard-components/src/Chart/StackedBar.svelte deleted file mode 100644 index f6e7a7a921..0000000000 --- a/packages/standard-components/src/Chart/StackedBar.svelte +++ /dev/null @@ -1,176 +0,0 @@ - - -
-{#if useLegend} -
-{/if} diff --git a/packages/standard-components/src/Chart/Step.svelte b/packages/standard-components/src/Chart/Step.svelte deleted file mode 100644 index b193d78f4c..0000000000 --- a/packages/standard-components/src/Chart/Step.svelte +++ /dev/null @@ -1,129 +0,0 @@ - - -
-{#if useLegend} -
-{/if} diff --git a/packages/standard-components/src/Chart/Temp.svelte b/packages/standard-components/src/Chart/Temp.svelte deleted file mode 100644 index 1703c7b604..0000000000 --- a/packages/standard-components/src/Chart/Temp.svelte +++ /dev/null @@ -1,41 +0,0 @@ - - -
-{#if useLegend} -
-{/if} diff --git a/packages/standard-components/src/Chart/Tooltip.svelte b/packages/standard-components/src/Chart/Tooltip.svelte deleted file mode 100644 index f2898c9607..0000000000 --- a/packages/standard-components/src/Chart/Tooltip.svelte +++ /dev/null @@ -1,81 +0,0 @@ - diff --git a/packages/standard-components/src/Chart/index.js b/packages/standard-components/src/Chart/index.js index a94abf8ac8..0dafa8a70d 100644 --- a/packages/standard-components/src/Chart/index.js +++ b/packages/standard-components/src/Chart/index.js @@ -1,14 +1,2 @@ -import "britecharts/dist/css/britecharts.min.css" - -export { default as donut } from "./Donut.svelte" export { default as bar } from "./Bar.svelte" export { default as line } from "./Line.svelte" -export { default as brush } from "./Brush.svelte" -export { default as bullet } from "./Bullet.svelte" -export { default as groupedbar } from "./GroupedBar.svelte" -export { default as heatmap } from "./Heatmap.svelte" -export { default as sparkline } from "./Sparkline.svelte" -export { default as scatterplot } from "./ScatterPlot.svelte" -export { default as step } from "./Step.svelte" -export { default as stackedarea } from "./StackedArea.svelte" -export { default as stackedbar } from "./StackedBar.svelte" diff --git a/packages/standard-components/src/Chart/tests/bar.html b/packages/standard-components/src/Chart/tests/bar.html deleted file mode 100644 index 9828587375..0000000000 --- a/packages/standard-components/src/Chart/tests/bar.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - Document - - - - - - - - - -
-

Bar Chart

-
-
- - - - \ No newline at end of file diff --git a/packages/standard-components/src/Chart/tests/line.html b/packages/standard-components/src/Chart/tests/line.html deleted file mode 100644 index 0340a3ddd4..0000000000 --- a/packages/standard-components/src/Chart/tests/line.html +++ /dev/null @@ -1,235 +0,0 @@ - - - - - - HTML Line - - - - - - - - - - - - - -
-
-
- - - - - \ No newline at end of file diff --git a/packages/standard-components/src/Chart/utils.js b/packages/standard-components/src/Chart/utils.js deleted file mode 100644 index 7cd682e88d..0000000000 --- a/packages/standard-components/src/Chart/utils.js +++ /dev/null @@ -1,41 +0,0 @@ -import britecharts from "britecharts" - -export const notNull = value => value || value === false - -export const hasProp = (data, prop) => data.every(d => prop in d) - -export const chartTypes = britecharts ? Object.keys(britecharts) : null - -//expose chart color schemas for use or reference outside compnent -export const colorSchemas = britecharts ? britecharts.colors.colorSchemas : null - -//export color gradients for use or reference outside the component -export const colorGradients = britecharts - ? britecharts.colors.colorGradients - : null - -export const getColorSchema = color => - color ? colorSchemas[color] : colorSchemas["britecharts"] - -export const getChartGradient = gradient => - gradient ? colorGradients[gradient] : null - -export function reformatDataKey(data = [], dataKey = null, formatKey = null) { - let ignoreList = ["_id", "_rev", "id"] - if (dataKey && data.every(d => d[dataKey])) { - return data.map(d => { - let clonedRow = { ...d } - if (clonedRow[formatKey]) { - delete clonedRow[formatKey] - } - let value = clonedRow[dataKey] - if (!ignoreList.includes(dataKey)) { - delete clonedRow[dataKey] - } - clonedRow[formatKey] = value - return clonedRow - }) - } else { - return data - } -} diff --git a/packages/standard-components/src/DataChart.svelte b/packages/standard-components/src/DataChart.svelte deleted file mode 100644 index 4948fa2cc6..0000000000 --- a/packages/standard-components/src/DataChart.svelte +++ /dev/null @@ -1,49 +0,0 @@ - - -
- -
diff --git a/packages/standard-components/src/index.js b/packages/standard-components/src/index.js index c99c2cbe56..60473bec70 100644 --- a/packages/standard-components/src/index.js +++ b/packages/standard-components/src/index.js @@ -5,7 +5,6 @@ export { default as text } from "./Text.svelte" export { default as heading } from "./Heading.svelte" export { default as input } from "./Input.svelte" export { default as textfield } from "./Textfield.svelte" - export { default as button } from "./Button.svelte" export { default as login } from "./Login.svelte" export { default as saveRowButton } from "./Templates/saveRowButton" @@ -15,7 +14,6 @@ export { default as Navigation } from "./Navigation.svelte" export { default as datagrid } from "./DataGrid/Component.svelte" export { default as dataform } from "./DataForm.svelte" export { default as dataformwide } from "./DataFormWide.svelte" -export { default as datachart } from "./DataChart.svelte" export { default as datalist } from "./DataList.svelte" export { default as list } from "./List.svelte" export { default as datasearch } from "./DataSearch.svelte" @@ -26,5 +24,5 @@ export { default as cardhorizontal } from "./CardHorizontal.svelte" export { default as rowdetail } from "./RowDetail.svelte" export { default as newrow } from "./NewRow.svelte" export { default as datepicker } from "./DatePicker.svelte" -export * from "./Chart" export { default as icon } from "./Icon.svelte" +export * from "./Chart"