From e4b4c5723fc9433bd1f117cd0e445dffb741fe64 Mon Sep 17 00:00:00 2001 From: cmack Date: Wed, 12 Aug 2020 10:02:36 +0100 Subject: [PATCH] WIP: Chart Tests and Line Refactor --- .../userInterface/temporaryPanelStructure.js | 87 +----- .../standard-components/src/Chart/Bar.svelte | 1 - .../src/Chart/GroupedBar.svelte | 8 +- .../standard-components/src/Chart/Line.svelte | 256 ++++++++++-------- .../src/Chart/Tooltip.svelte | 7 - .../src/Chart/tests/bar.html | 4 +- .../src/Chart/tests/line.html | 71 +++++ 7 files changed, 227 insertions(+), 207 deletions(-) create mode 100644 packages/standard-components/src/Chart/tests/line.html diff --git a/packages/builder/src/components/userInterface/temporaryPanelStructure.js b/packages/builder/src/components/userInterface/temporaryPanelStructure.js index b76c24725b..5605cad135 100644 --- a/packages/builder/src/components/userInterface/temporaryPanelStructure.js +++ b/packages/builder/src/components/userInterface/temporaryPanelStructure.js @@ -1580,58 +1580,6 @@ export default { _component: "@budibase/standard-components/line", description: "Line chart", icon: "ri-bar-chart-fill", - presetProps: { - data: { - data: [ - { - topicName: "San Francisco", - name: 1, - date: "2020-01-16", - value: 1, - }, - { - topicName: "San Fran", - name: 2, - date: "2020-01-17", - value: 2, - }, - { - topicName: "LA", - name: 3, - date: "2020-01-18", - value: 3, - }, - { - topicName: "Toronto", - name: 4, - date: "2020-01-19", - value: 7, - }, - { - topicName: "Van", - name: 4, - date: "2020-01-20", - value: 12, - }, - { - topicName: "Dundee", - name: 4, - date: "2020-01-21", - value: 16, - }, - { - topicName: "Dublin", - name: 4, - date: "2020-01-22", - value: 31, - }, - ], - }, - aspectRatio: 0.5, - grid: "horizontal", - dateLabel: "fullDate", - shouldShowAllDataPoints: true, - }, properties: { settings: [ { @@ -1639,16 +1587,6 @@ export default { key: "model", control: ModelSelect, }, - { - label: "X Axis Combo", - key: "axisTimeCombinations", - control: Input, - }, - { - label: "X Axis Combo", - key: "axisTimeCombinations", - control: Input, - }, { label: "Colors", key: "color", @@ -1688,6 +1626,16 @@ export default { key: "dateLabel", control: Input, }, + { + label: "Topic Label", + key: "topicLabel", + control: Input, + }, + { + label: "Value Label", + key: "valueLabel", + control: Input, + }, { label: "Width", key: "width", @@ -1721,21 +1669,6 @@ export default { "catmullRom", ], }, - { - label: "Locale", - key: "locale", - control: Input, - }, - { - label: "Topic Label", - key: "topicLabel", - control: Input, - }, - { - label: "Value Label", - key: "valueLabel", - control: Input, - }, { label: "X Axis Label", key: "xAxisLabel", diff --git a/packages/standard-components/src/Chart/Bar.svelte b/packages/standard-components/src/Chart/Bar.svelte index 42a1b22828..2a4018e33a 100644 --- a/packages/standard-components/src/Chart/Bar.svelte +++ b/packages/standard-components/src/Chart/Bar.svelte @@ -8,7 +8,6 @@ /* ISSUES: - x and y axis label set and appear in the dom but do not display next to the axis - - x and y axis label offset - does effect position of labels but does not render text (see above) - x tick label overlaps bar, seems to be no apu method to change this? Could do it by querying for it in the dom for this element: 4.0 */ diff --git a/packages/standard-components/src/Chart/GroupedBar.svelte b/packages/standard-components/src/Chart/GroupedBar.svelte index 05582de94d..9d0d4fe24c 100644 --- a/packages/standard-components/src/Chart/GroupedBar.svelte +++ b/packages/standard-components/src/Chart/GroupedBar.svelte @@ -159,11 +159,5 @@
{#if chartDrawn} - + {/if} diff --git a/packages/standard-components/src/Chart/Line.svelte b/packages/standard-components/src/Chart/Line.svelte index afb37322f3..ac67b83368 100644 --- a/packages/standard-components/src/Chart/Line.svelte +++ b/packages/standard-components/src/Chart/Line.svelte @@ -1,5 +1,6 @@
-{#if useLegend} -
-{/if} - - + diff --git a/packages/standard-components/src/Chart/Tooltip.svelte b/packages/standard-components/src/Chart/Tooltip.svelte index c510562c80..5df4320017 100644 --- a/packages/standard-components/src/Chart/Tooltip.svelte +++ b/packages/standard-components/src/Chart/Tooltip.svelte @@ -10,8 +10,6 @@ export let chartClass = "" let tooltipContainer - export let data = [] - export let axisTimeCombinations = null export let dateCustomFormat = null export let dateFormat = null @@ -32,11 +30,6 @@ tooltipContainer.datum([]).call(tooltip) }) - // $: if (chartDrawn) { - // tooltipContainer = select(`.${chartClass} .metadata-group`) - // tooltipContainer.datum([]).call(tooltip) - // } - $: if (tooltipContainer) { if (notNull(axisTimeCombinations)) { tooltip.axisTimeCombinations(axisTimeCombinations) diff --git a/packages/standard-components/src/Chart/tests/bar.html b/packages/standard-components/src/Chart/tests/bar.html index 4bedca035a..cf90c96c17 100644 --- a/packages/standard-components/src/Chart/tests/bar.html +++ b/packages/standard-components/src/Chart/tests/bar.html @@ -6,8 +6,8 @@ Document - + + diff --git a/packages/standard-components/src/Chart/tests/line.html b/packages/standard-components/src/Chart/tests/line.html new file mode 100644 index 0000000000..433c798c87 --- /dev/null +++ b/packages/standard-components/src/Chart/tests/line.html @@ -0,0 +1,71 @@ + + + + + + HTML Line + + + + + + + + + + + +
+
+
+ + + + + \ No newline at end of file