From 7e4ecd595580a0f42f06a928d7ac4c68f2a4951d Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Wed, 24 Feb 2021 18:57:40 -0800 Subject: [PATCH] Update LineChart stories to use contextual component interface --- ui/stories/charts/line-chart.stories.js | 89 +++++++++++++++++++------ 1 file changed, 69 insertions(+), 20 deletions(-) diff --git a/ui/stories/charts/line-chart.stories.js b/ui/stories/charts/line-chart.stories.js index d14cfec09..4f1f9219f 100644 --- a/ui/stories/charts/line-chart.stories.js +++ b/ui/stories/charts/line-chart.stories.js @@ -39,13 +39,21 @@ export let Standard = () => { template: hbs`
Line Chart
- {{#if lineChartData}} - + {{#if this.lineChartData}} + + <:svg as |c|> + + + {{/if}}
- {{#if lineChartMild}} - + {{#if this.lineChartMild}} + + <:svg as |c|> + + + {{/if}}
`, @@ -61,13 +69,21 @@ export let FluidWidth = () => { template: hbs`
Fluid-width Line Chart
- {{#if lineChartData}} - + {{#if this.lineChartData}} + + <:svg as |c|> + + + {{/if}}
- {{#if lineChartMild}} - + {{#if this.lineChartMild}} + + <:svg as |c|> + + + {{/if}}

A line chart will assume the width of its container. This includes the dimensions of the axes, which are calculated based on real DOM measurements. This requires a two-pass render: first the axes are placed with their real domains (in order to capture width and height of tick labels), second the axes are adjusted to make sure both the x and y axes are within the height and width bounds of the container.

@@ -84,8 +100,18 @@ export let LiveData = () => { template: hbs`
Live data Line Chart
- {{#if controller.lineChartLive}} - + {{#if this.controller.lineChartLive}} + + <:svg as |c|> + + + {{/if}}
`, @@ -125,8 +151,12 @@ export let Gaps = () => { template: hbs`
Line Chart data with gaps
- {{#if lineChartGapData}} - + {{#if this.lineChartGapData}} + + <:svg as |c|> + + + {{/if}}
`, @@ -157,9 +187,17 @@ export let Annotations = () => { @timeseries={{true}} @xProp="x" @yProp="y" - @data={{this.data}} - @annotations={{this.annotations}} - @onAnnotationClick={{action (mut this.activeAnnotation)}}/> + @data={{this.data}}> + <:svg as |c|> + + + <:after as |c|> + + + {{/if}}

{{this.activeAnnotation.info}}

@@ -171,9 +209,17 @@ export let Annotations = () => { @timeseries={{true}} @xProp="x" @yProp="y" - @data={{this.data}} - @annotations={{this.annotations}} - @onAnnotationClick={{action (mut this.activeAnnotation)}}/> + @data={{this.data}}> + <:svg as |c|> + + + <:after as |c|> + + + {{/if}} `, @@ -241,8 +287,11 @@ export let StepLine = () => { + @data={{this.data}}> + <:svg as |c|> + + +

{{this.activeAnnotation.info}}

{{/if}}