diff --git a/docs-ui/components/percentageBarChart.stories.js b/docs-ui/components/percentageAreaChart.stories.js similarity index 93% rename from docs-ui/components/percentageBarChart.stories.js rename to docs-ui/components/percentageAreaChart.stories.js index 8550821c989100..f3af4208e5fafd 100644 --- a/docs-ui/components/percentageBarChart.stories.js +++ b/docs-ui/components/percentageAreaChart.stories.js @@ -3,22 +3,22 @@ import React from 'react'; import {storiesOf} from '@storybook/react'; import {withInfo} from '@storybook/addon-info'; -import PercentageBarChart from 'app/components/charts/percentageBarChart'; +import PercentageAreaChart from 'app/components/charts/percentageAreaChart'; const TOTAL = 6; -storiesOf('Charts|PercentageBarChart', module).add( - 'PercentageBarChart', - withInfo('Stacked PercentageBar')(() => { +storiesOf('Charts|PercentageAreaChart', module).add( + 'PercentageAreaChart', + withInfo('Stacked PercentageArea')(() => { const NOW = new Date().getTime(); const getValue = () => Math.round(Math.random() * 1000); const getDate = num => NOW - (TOTAL - num) * 86400000; return (
-

Percentage Bar Charts Over Time

+

Percentage Area Charts Over Time

- + series={series.map(({seriesName, data, ...otherSeriesProps}, i) => AreaSeries({ stack: stacked ? 'area' : false, - name: s.seriesName, - data: s.data.map(({name, value}) => [name, value]), - lineStyle: { - color: '#fff', - width: 2, - }, - areaStyle: { - color: colors[i], - opacity: 1.0, - }, + areaStyle: {opacity: 1.0}, + ...otherSeriesProps, + name: seriesName, + data: data.map(({name, value}) => [name, value]), }) )} /> diff --git a/src/sentry/static/sentry/app/components/charts/percentageBarChart.jsx b/src/sentry/static/sentry/app/components/charts/percentageAreaChart.jsx similarity index 79% rename from src/sentry/static/sentry/app/components/charts/percentageBarChart.jsx rename to src/sentry/static/sentry/app/components/charts/percentageAreaChart.jsx index bed2779a17aca4..3aeb0e27e4383b 100644 --- a/src/sentry/static/sentry/app/components/charts/percentageBarChart.jsx +++ b/src/sentry/static/sentry/app/components/charts/percentageAreaChart.jsx @@ -2,7 +2,7 @@ import PropTypes from 'prop-types'; import React from 'react'; import moment from 'moment'; -import BarSeries from './series/barSeries.jsx'; +import AreaSeries from './series/areaSeries'; import BaseChart from './baseChart'; const FILLER_NAME = '__filler'; @@ -12,7 +12,7 @@ const FILLER_NAME = '__filler'; * * See https://exceljet.net/chart-type/100-stacked-bar-chart */ -export default class PercentageBarChart extends React.Component { +export default class PercentageAreaChart extends React.Component { static propTypes = { ...BaseChart.propTypes, @@ -38,33 +38,19 @@ export default class PercentageBarChart extends React.Component { const totals = new Map(totalsArray); return [ ...series.map(({seriesName, data}) => - BarSeries({ + AreaSeries({ barCategoryGap: 0, name: seriesName, - stack: 'percentageBarChartStack', + lineStyle: {width: 1}, + areaStyle: {opacity: 1}, + smooth: true, + stack: 'percentageAreaChartStack', data: data.map(dataObj => [ getDataItemName(dataObj), getValue(dataObj, totals.get(dataObj.name)), ]), }) ), - // Bar outline/filler if entire column is 0 - BarSeries({ - name: FILLER_NAME, - stack: 'percentageBarChartStack', - silent: true, - itemStyle: { - normal: { - color: '#eee', - }, - }, - emphasis: { - itemStyle: { - color: '#eee', - }, - }, - data: totalsArray.map(([name, total]) => [name, total === 0 ? 100 : 0]), - }), ]; }