import hbs from 'htmlbars-inline-precompile'; import EmberObject from '@ember/object'; import { on } from '@ember/object/evented'; import moment from 'moment'; import DelayedArray from '../utils/delayed-array'; export default { title: 'Charts|Line Chart', }; let data1 = [ { year: 2010, value: 10 }, { year: 2011, value: 10 }, { year: 2012, value: 20 }, { year: 2013, value: 30 }, { year: 2014, value: 50 }, { year: 2015, value: 80 }, { year: 2016, value: 130 }, { year: 2017, value: 210 }, { year: 2018, value: 340 }, ]; let data2 = [ { year: 2010, value: 100 }, { year: 2011, value: 90 }, { year: 2012, value: 120 }, { year: 2013, value: 130 }, { year: 2014, value: 115 }, { year: 2015, value: 105 }, { year: 2016, value: 90 }, { year: 2017, value: 85 }, { year: 2018, value: 90 }, ]; export let Standard = () => { return { template: hbs`
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.
`, context: { lineChartData: DelayedArray.create(data1), lineChartMild: DelayedArray.create(data2), }, }; }; export let LiveData = () => { return { template: hbs`