Browse Source

Chart legend and UI Updates

master
cmack 6 years ago
parent
commit
f1dd3e8a3d
  1. 2
      packages/builder/src/components/userInterface/PropertyControl.svelte
  2. 10
      packages/builder/src/components/userInterface/temporaryPanelStructure.js
  3. 28
      packages/standard-components/src/Chart/Donut.svelte
  4. 2
      packages/standard-components/src/Chart/Legend.svelte

2
packages/builder/src/components/userInterface/PropertyControl.svelte

@ -48,6 +48,7 @@
.property-control { .property-control {
display: flex; display: flex;
flex-flow: row; flex-flow: row;
width: 260px;
margin: 8px 0px; margin: 8px 0px;
align-items: center; align-items: center;
} }
@ -57,6 +58,7 @@
align-items: center; align-items: center;
font-size: 12px; font-size: 12px;
font-weight: 400; font-weight: 400;
width: 100px;
text-align: left; text-align: left;
color: var(--ink); color: var(--ink);
margin-right: auto; margin-right: auto;

10
packages/builder/src/components/userInterface/temporaryPanelStructure.js

@ -538,16 +538,6 @@ export default {
"yellow", "yellow",
], ],
}, },
{
label: "Height",
key: "height",
control: Input,
},
{
label: "Width",
key: "width",
control: Input,
},
{ {
label: "External Radius", label: "External Radius",
key: "externalRadius", key: "externalRadius",

28
packages/standard-components/src/Chart/Donut.svelte

@ -12,6 +12,7 @@
const chart = britecharts.donut() const chart = britecharts.donut()
const chartClass = `donut-container-${_id}` const chartClass = `donut-container-${_id}`
const legendClass = `legend-container-${_id}` const legendClass = `legend-container-${_id}`
let legendChart
let chartElement = null let chartElement = null
let chartContainer = null let chartContainer = null
@ -62,7 +63,9 @@
onMount(async () => { onMount(async () => {
if (chart) { if (chart) {
await fetchData() if (model) {
await fetchData()
}
chart.emptyDataConfig({ chart.emptyDataConfig({
showEmptySlice: true, showEmptySlice: true,
@ -133,17 +136,28 @@
if (customMouseMove) { if (customMouseMove) {
chart.on("customMouseMove", customMouseMove) chart.on("customMouseMove", customMouseMove)
} }
if (customMouseOut) {
chart.on("customMouseOut", customMouseOut) if (legendChart) {
} chart.on("customMouseOut", function() {
if (customMouseOver) { legendChart.clearHighlight()
chart.on("customMouseOver", customMouseOver) })
chart.on("customMouseOver", function(data) {
console.log("DATA", data.data)
legendChart.highlight(data.data.id)
})
} }
} }
$: _data = model ? $store[model] : data $: _data = model ? $store[model] : data
$: colorSchema = getColorSchema(color) $: colorSchema = getColorSchema(color)
</script> </script>
<div bind:this={chartElement} class={chartClass} /> <div bind:this={chartElement} class={chartClass} />
<Legend useLegend {chartClass} {width} data={_data} /> <Legend
bind:legend={legendChart}
{colorSchema}
useLegend
{chartClass}
{width}
data={_data} />

2
packages/standard-components/src/Chart/Legend.svelte

@ -19,7 +19,7 @@
export let numberFormat = null export let numberFormat = null
export let unit = null export let unit = null
let legend = britecharts.legend() export let legend = britecharts.legend() //exported it can be bound to
let legendContainer = null let legendContainer = null
let legendElement = null let legendElement = null

Loading…
Cancel
Save