Separate chart loading state from error state
This commit is contained in:
parent
9a4fc35bba
commit
8fde781a95
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
{#if options}
|
{#if options}
|
||||||
<div use:chart={options} />
|
<div use:chart={options} />
|
||||||
{:else}
|
{:else if options === false}
|
||||||
<div>Invalid chart options</div>
|
<div>Invalid chart options</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
// Fetch data on mount
|
// Fetch data on mount
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
if (!datasource || !labelColumn || !valueColumns || !valueColumns.length) {
|
if (!datasource || !labelColumn || !valueColumns || !valueColumns.length) {
|
||||||
|
options = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +40,7 @@
|
||||||
.slice(0, 20)
|
.slice(0, 20)
|
||||||
.sort((a, b) => (a[labelColumn] > b[labelColumn] ? 1 : -1))
|
.sort((a, b) => (a[labelColumn] > b[labelColumn] ? 1 : -1))
|
||||||
if (!schema || !data.length) {
|
if (!schema || !data.length) {
|
||||||
|
options = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
const allCols = [dateColumn, openColumn, highColumn, lowColumn, closeColumn]
|
const allCols = [dateColumn, openColumn, highColumn, lowColumn, closeColumn]
|
||||||
if (!datasource || allCols.find(x => x == null)) {
|
if (!datasource || allCols.find(x => x == null)) {
|
||||||
|
options = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +40,7 @@
|
||||||
.slice(0, 100)
|
.slice(0, 100)
|
||||||
.sort((a, b) => (a[dateColumn] > b[dateColumn] ? 1 : -1))
|
.sort((a, b) => (a[dateColumn] > b[dateColumn] ? 1 : -1))
|
||||||
if (!schema || !data.length) {
|
if (!schema || !data.length) {
|
||||||
|
options = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
// Fetch data on mount
|
// Fetch data on mount
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
if (!datasource || !labelColumn || !valueColumns || !valueColumns.length) {
|
if (!datasource || !labelColumn || !valueColumns || !valueColumns.length) {
|
||||||
|
options = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,6 +46,7 @@
|
||||||
.slice(0, 100)
|
.slice(0, 100)
|
||||||
.sort((a, b) => (a[labelColumn] > b[labelColumn] ? 1 : -1))
|
.sort((a, b) => (a[labelColumn] > b[labelColumn] ? 1 : -1))
|
||||||
if (!schema || !data.length) {
|
if (!schema || !data.length) {
|
||||||
|
options = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
// Fetch data on mount
|
// Fetch data on mount
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
if (!datasource || !labelColumn || !valueColumn) {
|
if (!datasource || !labelColumn || !valueColumn) {
|
||||||
|
options = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +35,7 @@
|
||||||
.slice(0, 20)
|
.slice(0, 20)
|
||||||
.sort((a, b) => (a[labelColumn] > b[labelColumn] ? 1 : -1))
|
.sort((a, b) => (a[labelColumn] > b[labelColumn] ? 1 : -1))
|
||||||
if (!schema || !data.length) {
|
if (!schema || !data.length) {
|
||||||
|
options = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue