Table / model integration for charts
This commit is contained in:
parent
bbf32cda75
commit
31dbf8e82f
|
@ -593,6 +593,11 @@ export default {
|
||||||
},
|
},
|
||||||
properties: {
|
properties: {
|
||||||
settings: [
|
settings: [
|
||||||
|
{
|
||||||
|
label: "Table",
|
||||||
|
key: "model",
|
||||||
|
control: ModelSelect,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "Color",
|
label: "Color",
|
||||||
key: "color",
|
key: "color",
|
||||||
|
@ -665,6 +670,11 @@ export default {
|
||||||
},
|
},
|
||||||
properties: {
|
properties: {
|
||||||
settings: [
|
settings: [
|
||||||
|
{
|
||||||
|
label: "Table",
|
||||||
|
key: "model",
|
||||||
|
control: ModelSelect,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "Colors",
|
label: "Colors",
|
||||||
key: "color",
|
key: "color",
|
||||||
|
@ -779,6 +789,11 @@ export default {
|
||||||
},
|
},
|
||||||
properties: {
|
properties: {
|
||||||
settings: [
|
settings: [
|
||||||
|
{
|
||||||
|
label: "Table",
|
||||||
|
key: "model",
|
||||||
|
control: ModelSelect,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "Color",
|
label: "Color",
|
||||||
key: "color",
|
key: "color",
|
||||||
|
@ -911,6 +926,11 @@ export default {
|
||||||
},
|
},
|
||||||
properties: {
|
properties: {
|
||||||
settings: [
|
settings: [
|
||||||
|
{
|
||||||
|
label: "Table",
|
||||||
|
key: "model",
|
||||||
|
control: ModelSelect,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "height",
|
label: "height",
|
||||||
key: "height",
|
key: "height",
|
||||||
|
@ -963,6 +983,11 @@ export default {
|
||||||
},
|
},
|
||||||
properties: {
|
properties: {
|
||||||
settings: [
|
settings: [
|
||||||
|
{
|
||||||
|
label: "Table",
|
||||||
|
key: "model",
|
||||||
|
control: ModelSelect,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "Line Gradient",
|
label: "Line Gradient",
|
||||||
key: "lineGradient",
|
key: "lineGradient",
|
||||||
|
@ -1038,6 +1063,11 @@ export default {
|
||||||
},
|
},
|
||||||
properties: {
|
properties: {
|
||||||
settings: [
|
settings: [
|
||||||
|
{
|
||||||
|
label: "Table",
|
||||||
|
key: "model",
|
||||||
|
control: ModelSelect,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "Y Axis Label",
|
label: "Y Axis Label",
|
||||||
key: "yAxisLabel",
|
key: "yAxisLabel",
|
||||||
|
@ -1145,6 +1175,11 @@ export default {
|
||||||
key: "nameLabel",
|
key: "nameLabel",
|
||||||
control: Input,
|
control: Input,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "Value Label",
|
||||||
|
key: "valueLabel",
|
||||||
|
control: Input,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "Number Format",
|
label: "Number Format",
|
||||||
key: "numberFormat",
|
key: "numberFormat",
|
||||||
|
@ -1178,6 +1213,11 @@ export default {
|
||||||
},
|
},
|
||||||
properties: {
|
properties: {
|
||||||
settings: [
|
settings: [
|
||||||
|
{
|
||||||
|
label: "Table",
|
||||||
|
key: "model",
|
||||||
|
control: ModelSelect,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "Gradient",
|
label: "Gradient",
|
||||||
key: "gradient",
|
key: "gradient",
|
||||||
|
@ -1282,6 +1322,11 @@ export default {
|
||||||
},
|
},
|
||||||
properties: {
|
properties: {
|
||||||
settings: [
|
settings: [
|
||||||
|
{
|
||||||
|
label: "Table",
|
||||||
|
key: "model",
|
||||||
|
control: ModelSelect,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "Color",
|
label: "Color",
|
||||||
key: "color",
|
key: "color",
|
||||||
|
@ -1374,6 +1419,11 @@ export default {
|
||||||
},
|
},
|
||||||
properties: {
|
properties: {
|
||||||
settings: [
|
settings: [
|
||||||
|
{
|
||||||
|
label: "Table",
|
||||||
|
key: "model",
|
||||||
|
control: ModelSelect,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "Color",
|
label: "Color",
|
||||||
key: "color",
|
key: "color",
|
||||||
|
@ -1435,6 +1485,11 @@ export default {
|
||||||
},
|
},
|
||||||
properties: {
|
properties: {
|
||||||
settings: [
|
settings: [
|
||||||
|
{
|
||||||
|
label: "Table",
|
||||||
|
key: "model",
|
||||||
|
control: ModelSelect,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "Colors",
|
label: "Colors",
|
||||||
key: "color",
|
key: "color",
|
||||||
|
@ -1609,6 +1664,11 @@ export default {
|
||||||
},
|
},
|
||||||
properties: {
|
properties: {
|
||||||
settings: [
|
settings: [
|
||||||
|
{
|
||||||
|
label: "Table",
|
||||||
|
key: "model",
|
||||||
|
control: ModelSelect,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "X Axis Combo",
|
label: "X Axis Combo",
|
||||||
key: "axisTimeCombinations",
|
key: "axisTimeCombinations",
|
||||||
|
|
|
@ -279,10 +279,10 @@
|
||||||
"description": "Donut Chart",
|
"description": "Donut Chart",
|
||||||
"data": true,
|
"data": true,
|
||||||
"props": {
|
"props": {
|
||||||
|
"model": "string",
|
||||||
"color": "string",
|
"color": "string",
|
||||||
"height": "number",
|
"height": "number",
|
||||||
"width": "number",
|
"width": "number",
|
||||||
"model": "string",
|
|
||||||
"hasFixedHighlightedSlice": "bool",
|
"hasFixedHighlightedSlice": "bool",
|
||||||
"hasLastHoverSliceHighlighted": "bool",
|
"hasLastHoverSliceHighlighted": "bool",
|
||||||
"hasHoverAnimation": "bool",
|
"hasHoverAnimation": "bool",
|
||||||
|
@ -299,6 +299,7 @@
|
||||||
"description": "Sparkline Chart",
|
"description": "Sparkline Chart",
|
||||||
"data": true,
|
"data": true,
|
||||||
"props": {
|
"props": {
|
||||||
|
"model": "string",
|
||||||
"areaGradient": "string",
|
"areaGradient": "string",
|
||||||
"height": "number",
|
"height": "number",
|
||||||
"width": "number",
|
"width": "number",
|
||||||
|
@ -314,6 +315,7 @@
|
||||||
"description": "Stacked Bar Chart",
|
"description": "Stacked Bar Chart",
|
||||||
"data": true,
|
"data": true,
|
||||||
"props": {
|
"props": {
|
||||||
|
"model": "string",
|
||||||
"color": "string",
|
"color": "string",
|
||||||
"height": "number",
|
"height": "number",
|
||||||
"width": "number",
|
"width": "number",
|
||||||
|
@ -342,6 +344,7 @@
|
||||||
"description": "Step Chart",
|
"description": "Step Chart",
|
||||||
"data": true,
|
"data": true,
|
||||||
"props": {
|
"props": {
|
||||||
|
"model": "string",
|
||||||
"color": "string",
|
"color": "string",
|
||||||
"height": "number",
|
"height": "number",
|
||||||
"width": "number",
|
"width": "number",
|
||||||
|
@ -375,6 +378,7 @@
|
||||||
"description": "Step Chart",
|
"description": "Step Chart",
|
||||||
"data": true,
|
"data": true,
|
||||||
"props": {
|
"props": {
|
||||||
|
"model": "string",
|
||||||
"height": "number",
|
"height": "number",
|
||||||
"width": "number",
|
"width": "number",
|
||||||
"margin": "string",
|
"margin": "string",
|
||||||
|
@ -389,6 +393,7 @@
|
||||||
"description": "Scatterplot Chart",
|
"description": "Scatterplot Chart",
|
||||||
"data": true,
|
"data": true,
|
||||||
"props": {
|
"props": {
|
||||||
|
"model": "string",
|
||||||
"color": "string",
|
"color": "string",
|
||||||
"height": "number",
|
"height": "number",
|
||||||
"width": "number",
|
"width": "number",
|
||||||
|
@ -411,6 +416,7 @@
|
||||||
"description": "Bar Chart",
|
"description": "Bar Chart",
|
||||||
"data": true,
|
"data": true,
|
||||||
"props": {
|
"props": {
|
||||||
|
"model": "string",
|
||||||
"betweenBarsPadding": "number",
|
"betweenBarsPadding": "number",
|
||||||
"gradient": "string",
|
"gradient": "string",
|
||||||
"color": "string",
|
"color": "string",
|
||||||
|
@ -425,7 +431,8 @@
|
||||||
"labelNumberFormat": "number",
|
"labelNumberFormat": "number",
|
||||||
"labelSize": "number",
|
"labelSize": "number",
|
||||||
"locale": "string",
|
"locale": "string",
|
||||||
"nameLabel": "string",
|
"nameLabel": "string",
|
||||||
|
"valueLabel": "string",
|
||||||
"numberLabel": "string",
|
"numberLabel": "string",
|
||||||
"xAxisLabel": "string",
|
"xAxisLabel": "string",
|
||||||
"yAxisLabel": "string",
|
"yAxisLabel": "string",
|
||||||
|
@ -438,6 +445,7 @@
|
||||||
"description": "Line Chart",
|
"description": "Line Chart",
|
||||||
"data": true,
|
"data": true,
|
||||||
"props": {
|
"props": {
|
||||||
|
"model": "string",
|
||||||
"width": "number",
|
"width": "number",
|
||||||
"height": "number",
|
"height": "number",
|
||||||
"axisTimeCombinations": "string",
|
"axisTimeCombinations": "string",
|
||||||
|
@ -463,6 +471,7 @@
|
||||||
"description": "brush chart",
|
"description": "brush chart",
|
||||||
"data": true,
|
"data": true,
|
||||||
"props": {
|
"props": {
|
||||||
|
"model": "string",
|
||||||
"gradient": "string",
|
"gradient": "string",
|
||||||
"height": "number",
|
"height": "number",
|
||||||
"width": "number",
|
"width": "number",
|
||||||
|
@ -479,6 +488,7 @@
|
||||||
"description": "Groupedbar chart",
|
"description": "Groupedbar chart",
|
||||||
"data": true,
|
"data": true,
|
||||||
"props": {
|
"props": {
|
||||||
|
"model": "string",
|
||||||
"color": "string",
|
"color": "string",
|
||||||
"height": "number",
|
"height": "number",
|
||||||
"width": "number",
|
"width": "number",
|
||||||
|
@ -491,6 +501,7 @@
|
||||||
"description": "Groupedbar chart",
|
"description": "Groupedbar chart",
|
||||||
"data": true,
|
"data": true,
|
||||||
"props": {
|
"props": {
|
||||||
|
"model": "string",
|
||||||
"color": "string",
|
"color": "string",
|
||||||
"height": "string",
|
"height": "string",
|
||||||
"width": "string",
|
"width": "string",
|
||||||
|
@ -511,6 +522,7 @@
|
||||||
"description": "Bullet chart",
|
"description": "Bullet chart",
|
||||||
"data": true,
|
"data": true,
|
||||||
"props": {
|
"props": {
|
||||||
|
"model": "string",
|
||||||
"color": "string",
|
"color": "string",
|
||||||
"customSubtitle": "string",
|
"customSubtitle": "string",
|
||||||
"customTitle": "string",
|
"customTitle": "string",
|
||||||
|
|
|
@ -56,16 +56,36 @@
|
||||||
|
|
||||||
export let useLegend = true
|
export let useLegend = true
|
||||||
|
|
||||||
onMount(() => {
|
export let _bb
|
||||||
|
export let model
|
||||||
|
|
||||||
|
let store = _bb.store
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
if (chartElement) {
|
if (chartElement) {
|
||||||
|
await fetchData()
|
||||||
chartContainer = select(`.${chartClass}`)
|
chartContainer = select(`.${chartClass}`)
|
||||||
bindChartUIProps()
|
bindChartUIProps()
|
||||||
bindChartEvents()
|
bindChartEvents()
|
||||||
chartContainer.datum(data).call(chart)
|
chartContainer.datum(_data).call(chart)
|
||||||
bindChartTooltip()
|
bindChartTooltip()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
async function fetchData() {
|
||||||
|
const FETCH_RECORDS_URL = `/api/views/all_${model}`
|
||||||
|
const response = await _bb.api.get(FETCH_RECORDS_URL)
|
||||||
|
if (response.status === 200) {
|
||||||
|
const json = await response.json()
|
||||||
|
store.update(state => {
|
||||||
|
state[model] = json
|
||||||
|
return state
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
throw new Error("Failed to fetch records.", response)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function bindChartUIProps() {
|
function bindChartUIProps() {
|
||||||
if (color) {
|
if (color) {
|
||||||
chart.colorSchema(colorSchema)
|
chart.colorSchema(colorSchema)
|
||||||
|
@ -165,6 +185,8 @@
|
||||||
tooltipContainer.datum([]).call(tooltip)
|
tooltipContainer.datum([]).call(tooltip)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$: _data = model ? $store[model] : data
|
||||||
|
|
||||||
$: colorSchema = getColorSchema(color)
|
$: colorSchema = getColorSchema(color)
|
||||||
$: chartGradient = getChartGradient(gradient)
|
$: chartGradient = getChartGradient(gradient)
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -11,6 +11,11 @@
|
||||||
- Chart gradient doesn't seem to do anything
|
- Chart gradient doesn't seem to do anything
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
export let _bb
|
||||||
|
export let model
|
||||||
|
|
||||||
|
let store = _bb.store
|
||||||
|
|
||||||
const _id = shortid.generate()
|
const _id = shortid.generate()
|
||||||
|
|
||||||
const chart = britecharts.brush()
|
const chart = britecharts.brush()
|
||||||
|
@ -36,15 +41,32 @@
|
||||||
export let xTicks = null
|
export let xTicks = null
|
||||||
export let xAxisCustomFormat = null
|
export let xAxisCustomFormat = null
|
||||||
|
|
||||||
onMount(() => {
|
onMount(async () => {
|
||||||
if (chart) {
|
if (chart) {
|
||||||
|
if (model) {
|
||||||
|
await fetchData()
|
||||||
|
}
|
||||||
chartContainer = select(`.${chartClass}`)
|
chartContainer = select(`.${chartClass}`)
|
||||||
bindChartUIProps()
|
bindChartUIProps()
|
||||||
bindChartEvents()
|
bindChartEvents()
|
||||||
chartContainer.datum(data).call(chart)
|
chartContainer.datum(_data).call(chart)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
async function fetchData() {
|
||||||
|
const FETCH_RECORDS_URL = `/api/views/all_${model}`
|
||||||
|
const response = await _bb.api.get(FETCH_RECORDS_URL)
|
||||||
|
if (response.status === 200) {
|
||||||
|
const json = await response.json()
|
||||||
|
store.update(state => {
|
||||||
|
state[model] = json
|
||||||
|
return state
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
throw new Error("Failed to fetch records.", response)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function bindChartUIProps() {
|
function bindChartUIProps() {
|
||||||
if (notNull(gradient)) {
|
if (notNull(gradient)) {
|
||||||
chart.gradient(chartGradient)
|
chart.gradient(chartGradient)
|
||||||
|
@ -87,6 +109,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$: _data = model ? $store[model] : data
|
||||||
|
|
||||||
$: chartGradient = getChartGradient(gradient)
|
$: chartGradient = getChartGradient(gradient)
|
||||||
$: console.log(chartGradient)
|
$: console.log(chartGradient)
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -8,6 +8,11 @@
|
||||||
|
|
||||||
const _id = shortid.generate()
|
const _id = shortid.generate()
|
||||||
|
|
||||||
|
export let _bb
|
||||||
|
export let model
|
||||||
|
|
||||||
|
let store = _bb.store
|
||||||
|
|
||||||
const chart = britecharts.bullet()
|
const chart = britecharts.bullet()
|
||||||
const chartClass = `bullet-container-${_id}`
|
const chartClass = `bullet-container-${_id}`
|
||||||
const legendClass = `legend-container-${_id}`
|
const legendClass = `legend-container-${_id}`
|
||||||
|
@ -29,14 +34,31 @@
|
||||||
export let width = 200
|
export let width = 200
|
||||||
export let margin = { top: 0, right: 0, bottom: 0, left: 0 }
|
export let margin = { top: 0, right: 0, bottom: 0, left: 0 }
|
||||||
|
|
||||||
onMount(() => {
|
onMount(async () => {
|
||||||
if (chart) {
|
if (chart) {
|
||||||
|
if (model) {
|
||||||
|
await fetchData()
|
||||||
|
}
|
||||||
chartContainer = select(`.${chartClass}`)
|
chartContainer = select(`.${chartClass}`)
|
||||||
bindChartUIProps()
|
bindChartUIProps()
|
||||||
chartContainer.datum(data).call(chart)
|
chartContainer.datum(_data).call(chart)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
async function fetchData() {
|
||||||
|
const FETCH_RECORDS_URL = `/api/views/all_${model}`
|
||||||
|
const response = await _bb.api.get(FETCH_RECORDS_URL)
|
||||||
|
if (response.status === 200) {
|
||||||
|
const json = await response.json()
|
||||||
|
store.update(state => {
|
||||||
|
state[model] = json
|
||||||
|
return state
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
throw new Error("Failed to fetch records.", response)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function bindChartUIProps() {
|
function bindChartUIProps() {
|
||||||
if (notNull(color)) {
|
if (notNull(color)) {
|
||||||
chart.colorSchema(colorSchema)
|
chart.colorSchema(colorSchema)
|
||||||
|
@ -73,6 +95,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$: _data = model ? $store[model] : data
|
||||||
|
|
||||||
$: colorSchema = getColorSchema(color)
|
$: colorSchema = getColorSchema(color)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -60,15 +60,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
|
||||||
await fetchData()
|
|
||||||
})
|
|
||||||
|
|
||||||
$: _data = model ? $store[model] : data
|
$: _data = model ? $store[model] : data
|
||||||
$: console.log("_data", _data)
|
$: console.log("_data", _data)
|
||||||
|
|
||||||
onMount(() => {
|
onMount(async () => {
|
||||||
if (chart) {
|
if (chart) {
|
||||||
|
await fetchData()
|
||||||
|
|
||||||
chart.emptyDataConfig({
|
chart.emptyDataConfig({
|
||||||
showEmptySlice: true,
|
showEmptySlice: true,
|
||||||
emptySliceColor: "#000000",
|
emptySliceColor: "#000000",
|
||||||
|
@ -76,7 +74,7 @@
|
||||||
chartContainer = select(`.${chartClass}`)
|
chartContainer = select(`.${chartClass}`)
|
||||||
bindChartUIProps()
|
bindChartUIProps()
|
||||||
bindChartEvents()
|
bindChartEvents()
|
||||||
chartContainer.datum(data).call(chart)
|
chartContainer.datum(_data).call(chart)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,11 @@
|
||||||
|
|
||||||
const _id = shortid.generate()
|
const _id = shortid.generate()
|
||||||
|
|
||||||
|
export let _bb
|
||||||
|
export let model
|
||||||
|
|
||||||
|
let store = _bb.store
|
||||||
|
|
||||||
const chart = britecharts.groupedBar()
|
const chart = britecharts.groupedBar()
|
||||||
const chartClass = `groupedbar-container-${_id}`
|
const chartClass = `groupedbar-container-${_id}`
|
||||||
const legendClass = `legend-container-${_id}`
|
const legendClass = `legend-container-${_id}`
|
||||||
|
@ -48,8 +53,11 @@
|
||||||
export let yTickTextOffset = null
|
export let yTickTextOffset = null
|
||||||
export let useLegend = true
|
export let useLegend = true
|
||||||
|
|
||||||
onMount(() => {
|
onMount(async () => {
|
||||||
if (chart) {
|
if (chart) {
|
||||||
|
if (model) {
|
||||||
|
await fetchData()
|
||||||
|
}
|
||||||
chartContainer = select(`.${chartClass}`)
|
chartContainer = select(`.${chartClass}`)
|
||||||
bindChartUIProps()
|
bindChartUIProps()
|
||||||
// bindChartEvents()
|
// bindChartEvents()
|
||||||
|
@ -58,6 +66,20 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
async function fetchData() {
|
||||||
|
const FETCH_RECORDS_URL = `/api/views/all_${model}`
|
||||||
|
const response = await _bb.api.get(FETCH_RECORDS_URL)
|
||||||
|
if (response.status === 200) {
|
||||||
|
const json = await response.json()
|
||||||
|
store.update(state => {
|
||||||
|
state[model] = json
|
||||||
|
return state
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
throw new Error("Failed to fetch records.", response)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function bindChartUIProps() {
|
function bindChartUIProps() {
|
||||||
if (notNull(color)) {
|
if (notNull(color)) {
|
||||||
chart.colorSchema(colorSchema)
|
chart.colorSchema(colorSchema)
|
||||||
|
@ -130,6 +152,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$: _data = model ? $store[model] : data
|
||||||
|
|
||||||
$: colorSchema = getColorSchema(color)
|
$: colorSchema = getColorSchema(color)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,11 @@
|
||||||
|
|
||||||
const _id = shortid.generate()
|
const _id = shortid.generate()
|
||||||
|
|
||||||
|
export let _bb
|
||||||
|
export let model
|
||||||
|
|
||||||
|
let store = _bb.store
|
||||||
|
|
||||||
const chart = britecharts.heatmap()
|
const chart = britecharts.heatmap()
|
||||||
const chartClass = `heatmap-container-${_id}`
|
const chartClass = `heatmap-container-${_id}`
|
||||||
const legendClass = `legend-container-${_id}`
|
const legendClass = `legend-container-${_id}`
|
||||||
|
@ -24,14 +29,31 @@
|
||||||
export let yAxisLabels = null
|
export let yAxisLabels = null
|
||||||
export let boxSize = null
|
export let boxSize = null
|
||||||
|
|
||||||
onMount(() => {
|
onMount(async () => {
|
||||||
if (chart) {
|
if (chart) {
|
||||||
|
if (model) {
|
||||||
|
await fetchData()
|
||||||
|
}
|
||||||
chartContainer = select(`.${chartClass}`)
|
chartContainer = select(`.${chartClass}`)
|
||||||
bindChartUIProps()
|
bindChartUIProps()
|
||||||
chartContainer.datum(data).call(chart)
|
chartContainer.datum(data).call(chart)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
async function fetchData() {
|
||||||
|
const FETCH_RECORDS_URL = `/api/views/all_${model}`
|
||||||
|
const response = await _bb.api.get(FETCH_RECORDS_URL)
|
||||||
|
if (response.status === 200) {
|
||||||
|
const json = await response.json()
|
||||||
|
store.update(state => {
|
||||||
|
state[model] = json
|
||||||
|
return state
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
throw new Error("Failed to fetch records.", response)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function bindChartUIProps() {
|
function bindChartUIProps() {
|
||||||
if (notNull(color)) {
|
if (notNull(color)) {
|
||||||
chart.colorSchema(colorSchema)
|
chart.colorSchema(colorSchema)
|
||||||
|
@ -50,6 +72,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$: _data = model ? $store[model] : data
|
||||||
|
|
||||||
$: colorSchema = getColorSchema(color)
|
$: colorSchema = getColorSchema(color)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,11 @@
|
||||||
|
|
||||||
const _id = shortid.generate()
|
const _id = shortid.generate()
|
||||||
|
|
||||||
|
export let _bb
|
||||||
|
export let model
|
||||||
|
|
||||||
|
let store = _bb.store
|
||||||
|
|
||||||
const chart = britecharts.line()
|
const chart = britecharts.line()
|
||||||
const chartClass = `line-container-${_id}`
|
const chartClass = `line-container-${_id}`
|
||||||
const legendClass = `legend-container-${_id}`
|
const legendClass = `legend-container-${_id}`
|
||||||
|
@ -49,14 +54,33 @@
|
||||||
export let lines = null //not handled by setting prop
|
export let lines = null //not handled by setting prop
|
||||||
export let tooltipThreshold = null
|
export let tooltipThreshold = null
|
||||||
|
|
||||||
onMount(() => {
|
onMount(async () => {
|
||||||
chartContainer = select(`.${chartClass}`)
|
if (chart) {
|
||||||
bindChartUIProps()
|
if (model) {
|
||||||
bindChartEvents()
|
await fetchData()
|
||||||
chartContainer.datum(data).call(chart)
|
}
|
||||||
bindChartTooltip()
|
chartContainer = select(`.${chartClass}`)
|
||||||
|
bindChartUIProps()
|
||||||
|
bindChartEvents()
|
||||||
|
chartContainer.datum(_data).call(chart)
|
||||||
|
bindChartTooltip()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
async function fetchData() {
|
||||||
|
const FETCH_RECORDS_URL = `/api/views/all_${model}`
|
||||||
|
const response = await _bb.api.get(FETCH_RECORDS_URL)
|
||||||
|
if (response.status === 200) {
|
||||||
|
const json = await response.json()
|
||||||
|
store.update(state => {
|
||||||
|
state[model] = json
|
||||||
|
return state
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
throw new Error("Failed to fetch records.", response)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function bindChartUIProps() {
|
function bindChartUIProps() {
|
||||||
if (notNull(color)) {
|
if (notNull(color)) {
|
||||||
chart.colorSchema(colorSchema)
|
chart.colorSchema(colorSchema)
|
||||||
|
@ -148,6 +172,8 @@
|
||||||
tooltipContainer.datum([]).call(tooltip)
|
tooltipContainer.datum([]).call(tooltip)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$: _data = model ? $store[model] : data
|
||||||
|
|
||||||
$: colorSchema = getColorSchema(color)
|
$: colorSchema = getColorSchema(color)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,11 @@
|
||||||
|
|
||||||
const _id = shortid.generate()
|
const _id = shortid.generate()
|
||||||
|
|
||||||
|
export let _bb
|
||||||
|
export let model
|
||||||
|
|
||||||
|
let store = _bb.store
|
||||||
|
|
||||||
const chart = britecharts.scatterPlot()
|
const chart = britecharts.scatterPlot()
|
||||||
const chartClass = `scatterplot-container-${_id}`
|
const chartClass = `scatterplot-container-${_id}`
|
||||||
const legendClass = `legend-container-${_id}`
|
const legendClass = `legend-container-${_id}`
|
||||||
|
@ -51,16 +56,33 @@
|
||||||
export let yTicks = null
|
export let yTicks = null
|
||||||
export let useLegend = true
|
export let useLegend = true
|
||||||
|
|
||||||
onMount(() => {
|
onMount(async () => {
|
||||||
if (chart) {
|
if (chart) {
|
||||||
|
if (model) {
|
||||||
|
await fetchData()
|
||||||
|
}
|
||||||
chartContainer = select(`.${chartClass}`)
|
chartContainer = select(`.${chartClass}`)
|
||||||
bindChartUIProps()
|
bindChartUIProps()
|
||||||
bindChartEvents()
|
bindChartEvents()
|
||||||
chartContainer.datum(data).call(chart)
|
chartContainer.datum(_data).call(chart)
|
||||||
bindChartTooltip()
|
bindChartTooltip()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
async function fetchData() {
|
||||||
|
const FETCH_RECORDS_URL = `/api/views/all_${model}`
|
||||||
|
const response = await _bb.api.get(FETCH_RECORDS_URL)
|
||||||
|
if (response.status === 200) {
|
||||||
|
const json = await response.json()
|
||||||
|
store.update(state => {
|
||||||
|
state[model] = json
|
||||||
|
return state
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
throw new Error("Failed to fetch records.", response)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function bindChartUIProps() {
|
function bindChartUIProps() {
|
||||||
if (notNull(color)) {
|
if (notNull(color)) {
|
||||||
chart.colorSchema(colorSchema)
|
chart.colorSchema(colorSchema)
|
||||||
|
@ -154,6 +176,8 @@
|
||||||
tooltipContainer.datum([]).call(tooltip)
|
tooltipContainer.datum([]).call(tooltip)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$: _data = model ? $store[model] : data
|
||||||
|
|
||||||
$: colorSchema = getColorSchema(color)
|
$: colorSchema = getColorSchema(color)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,11 @@
|
||||||
|
|
||||||
const _id = shortid.generate()
|
const _id = shortid.generate()
|
||||||
|
|
||||||
|
export let _bb
|
||||||
|
export let model
|
||||||
|
|
||||||
|
let store = _bb.store
|
||||||
|
|
||||||
const chart = britecharts.sparkline()
|
const chart = britecharts.sparkline()
|
||||||
const chartClass = `sparkline-container-${_id}`
|
const chartClass = `sparkline-container-${_id}`
|
||||||
const legendClass = `legend-container-${_id}`
|
const legendClass = `legend-container-${_id}`
|
||||||
|
@ -28,14 +33,31 @@
|
||||||
export let valueLabel = null
|
export let valueLabel = null
|
||||||
export let useLegend = true
|
export let useLegend = true
|
||||||
|
|
||||||
onMount(() => {
|
onMount(async () => {
|
||||||
if (chart) {
|
if (chart) {
|
||||||
|
if (model) {
|
||||||
|
await fetchData()
|
||||||
|
}
|
||||||
chartContainer = select(`.${chartClass}`)
|
chartContainer = select(`.${chartClass}`)
|
||||||
bindChartUIProps()
|
bindChartUIProps()
|
||||||
chartContainer.datum(data).call(chart)
|
chartContainer.datum(_data).call(chart)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
async function fetchData() {
|
||||||
|
const FETCH_RECORDS_URL = `/api/views/all_${model}`
|
||||||
|
const response = await _bb.api.get(FETCH_RECORDS_URL)
|
||||||
|
if (response.status === 200) {
|
||||||
|
const json = await response.json()
|
||||||
|
store.update(state => {
|
||||||
|
state[model] = json
|
||||||
|
return state
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
throw new Error("Failed to fetch records.", response)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function bindChartUIProps() {
|
function bindChartUIProps() {
|
||||||
if (notNull(areaGradient)) {
|
if (notNull(areaGradient)) {
|
||||||
chart.areaGradient(aGradient)
|
chart.areaGradient(aGradient)
|
||||||
|
@ -69,6 +91,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$: _data = model ? $store[model] : data
|
||||||
|
|
||||||
$: aGradient = getChartGradient(areaGradient)
|
$: aGradient = getChartGradient(areaGradient)
|
||||||
$: lGradient = getChartGradient(lineGradient)
|
$: lGradient = getChartGradient(lineGradient)
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -8,6 +8,11 @@
|
||||||
|
|
||||||
const _id = shortid.generate()
|
const _id = shortid.generate()
|
||||||
|
|
||||||
|
export let _bb
|
||||||
|
export let model
|
||||||
|
|
||||||
|
let store = _bb.store
|
||||||
|
|
||||||
const chart = britecharts.stackedArea()
|
const chart = britecharts.stackedArea()
|
||||||
const chartClass = `stackedarea-container-${_id}`
|
const chartClass = `stackedarea-container-${_id}`
|
||||||
const legendClass = `legend-container-${_id}`
|
const legendClass = `legend-container-${_id}`
|
||||||
|
@ -51,16 +56,33 @@
|
||||||
export let yTicks = null
|
export let yTicks = null
|
||||||
export let useLegend = true
|
export let useLegend = true
|
||||||
|
|
||||||
onMount(() => {
|
onMount(async () => {
|
||||||
if (chart) {
|
if (chart) {
|
||||||
|
if (model) {
|
||||||
|
await fetchData()
|
||||||
|
}
|
||||||
chartContainer = select(`.${chartClass}`)
|
chartContainer = select(`.${chartClass}`)
|
||||||
bindChartUIProps()
|
bindChartUIProps()
|
||||||
bindChartEvents()
|
bindChartEvents()
|
||||||
chartContainer.datum(data).call(chart)
|
chartContainer.datum(_data).call(chart)
|
||||||
bindChartTooltip()
|
bindChartTooltip()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
async function fetchData() {
|
||||||
|
const FETCH_RECORDS_URL = `/api/views/all_${model}`
|
||||||
|
const response = await _bb.api.get(FETCH_RECORDS_URL)
|
||||||
|
if (response.status === 200) {
|
||||||
|
const json = await response.json()
|
||||||
|
store.update(state => {
|
||||||
|
state[model] = json
|
||||||
|
return state
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
throw new Error("Failed to fetch records.", response)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function bindChartUIProps() {
|
function bindChartUIProps() {
|
||||||
if (notNull(color)) {
|
if (notNull(color)) {
|
||||||
chart.colorSchema(colorSchema)
|
chart.colorSchema(colorSchema)
|
||||||
|
@ -148,6 +170,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$: _data = model ? $store[model] : data
|
||||||
|
|
||||||
$: colorSchema = getColorSchema(color)
|
$: colorSchema = getColorSchema(color)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,11 @@
|
||||||
const chartClass = `stackedbar-container-${_id}`
|
const chartClass = `stackedbar-container-${_id}`
|
||||||
const legendClass = `legend-container-${_id}`
|
const legendClass = `legend-container-${_id}`
|
||||||
|
|
||||||
|
export let _bb
|
||||||
|
export let model
|
||||||
|
|
||||||
|
let store = _bb.store
|
||||||
|
|
||||||
let chartElement = null
|
let chartElement = null
|
||||||
let chartContainer = null
|
let chartContainer = null
|
||||||
let tooltip
|
let tooltip
|
||||||
|
@ -46,16 +51,33 @@
|
||||||
export let yAxisLabelOffset = null
|
export let yAxisLabelOffset = null
|
||||||
export let useLegend = true
|
export let useLegend = true
|
||||||
|
|
||||||
onMount(() => {
|
onMount(async () => {
|
||||||
if (chart) {
|
if (chart) {
|
||||||
|
if (model) {
|
||||||
|
await fetchData()
|
||||||
|
}
|
||||||
chartContainer = select(`.${chartClass}`)
|
chartContainer = select(`.${chartClass}`)
|
||||||
bindChartUIProps()
|
bindChartUIProps()
|
||||||
bindChartEvents()
|
bindChartEvents()
|
||||||
chartContainer.datum(data).call(chart)
|
chartContainer.datum(_data).call(chart)
|
||||||
// bindChartTooltip()
|
// bindChartTooltip()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
async function fetchData() {
|
||||||
|
const FETCH_RECORDS_URL = `/api/views/all_${model}`
|
||||||
|
const response = await _bb.api.get(FETCH_RECORDS_URL)
|
||||||
|
if (response.status === 200) {
|
||||||
|
const json = await response.json()
|
||||||
|
store.update(state => {
|
||||||
|
state[model] = json
|
||||||
|
return state
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
throw new Error("Failed to fetch records.", response)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function bindChartUIProps() {
|
function bindChartUIProps() {
|
||||||
//UI PROPS
|
//UI PROPS
|
||||||
if (notNull(color)) {
|
if (notNull(color)) {
|
||||||
|
@ -143,6 +165,8 @@
|
||||||
tooltipContainer.datum([]).call(tooltip)
|
tooltipContainer.datum([]).call(tooltip)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$: _data = model ? $store[model] : data
|
||||||
|
|
||||||
$: colorSchema = getColorSchema(color)
|
$: colorSchema = getColorSchema(color)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,11 @@
|
||||||
|
|
||||||
const _id = shortid.generate()
|
const _id = shortid.generate()
|
||||||
|
|
||||||
|
export let _bb
|
||||||
|
export let model
|
||||||
|
|
||||||
|
let store = _bb.store
|
||||||
|
|
||||||
const chart = britecharts.step()
|
const chart = britecharts.step()
|
||||||
const chartClass = `step-container-${_id}`
|
const chartClass = `step-container-${_id}`
|
||||||
const legendClass = `legend-container-${_id}`
|
const legendClass = `legend-container-${_id}`
|
||||||
|
@ -41,16 +46,33 @@
|
||||||
export let yTicks = null
|
export let yTicks = null
|
||||||
export let useLegend = true
|
export let useLegend = true
|
||||||
|
|
||||||
onMount(() => {
|
onMount(async () => {
|
||||||
if (chart) {
|
if (chart) {
|
||||||
|
if (model) {
|
||||||
|
await fetchData()
|
||||||
|
}
|
||||||
chartContainer = select(`.${chartClass}`)
|
chartContainer = select(`.${chartClass}`)
|
||||||
bindChartUIProps()
|
bindChartUIProps()
|
||||||
bindChartEvents()
|
bindChartEvents()
|
||||||
chartContainer.datum(data).call(chart)
|
chartContainer.datum(_data).call(chart)
|
||||||
bindChartTooltip()
|
bindChartTooltip()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
async function fetchData() {
|
||||||
|
const FETCH_RECORDS_URL = `/api/views/all_${model}`
|
||||||
|
const response = await _bb.api.get(FETCH_RECORDS_URL)
|
||||||
|
if (response.status === 200) {
|
||||||
|
const json = await response.json()
|
||||||
|
store.update(state => {
|
||||||
|
state[model] = json
|
||||||
|
return state
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
throw new Error("Failed to fetch records.", response)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function bindChartUIProps() {
|
function bindChartUIProps() {
|
||||||
if (notNull(height)) {
|
if (notNull(height)) {
|
||||||
chart.height(height)
|
chart.height(height)
|
||||||
|
@ -96,6 +118,8 @@
|
||||||
tooltipContainer.datum([]).call(tooltip)
|
tooltipContainer.datum([]).call(tooltip)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$: _data = model ? $store[model] : data
|
||||||
|
|
||||||
$: colorSchema = getColorSchema(color)
|
$: colorSchema = getColorSchema(color)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue