Skip to content

Commit

Permalink
BUGFIX: RAIL-1062 Area chart should have only one viewBy attribute an…
Browse files Browse the repository at this point in the history
…d only one stackBy attribute
  • Loading branch information
David Ocetnik committed Jul 20, 2018
1 parent 43d3f6b commit 02a8475
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 35 deletions.
18 changes: 8 additions & 10 deletions examples/src/components/AreaChartExample.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,21 @@ export class AreaChartExample extends Component {
}
];

const attributes = [
{
visualizationAttribute: {
displayForm: {
identifier: monthDateIdentifier
},
localIdentifier: 'month'
}
const viewBy = {
visualizationAttribute: {
displayForm: {
identifier: monthDateIdentifier
},
localIdentifier: 'month'
}
];
};

return (
<div style={{ height: 300 }} className="s-area-chart">
<AreaChart
projectId={projectId}
measures={measures}
viewBy={attributes}
viewBy={viewBy}
onLoadingChanged={this.onLoadingChanged}
onError={this.onError}
config={{
Expand Down
18 changes: 8 additions & 10 deletions examples/src/components/StackedAreaChartExample.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,21 @@ export class StackedAreaChartExample extends Component {
}
];

const attributes = [
{
visualizationAttribute: {
displayForm: {
identifier: monthDateIdentifier
},
localIdentifier: 'month'
}
const viewBy = {
visualizationAttribute: {
displayForm: {
identifier: monthDateIdentifier
},
localIdentifier: 'month'
}
];
};

return (
<div style={{ height: 300 }} className="s-area-chart">
<AreaChart
projectId={projectId}
measures={measures}
viewBy={attributes}
viewBy={viewBy}
onLoadingChanged={this.onLoadingChanged}
onError={this.onError}
config={{
Expand Down
8 changes: 4 additions & 4 deletions src/components/AreaChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { getStackingResultSpec } from '../helpers/resultSpec';

export interface IAreaChartBucketProps extends ICommonChartProps {
measures: VisualizationObject.BucketItem[];
viewBy?: VisualizationObject.IVisualizationAttribute[];
stackBy?: VisualizationObject.IVisualizationAttribute[];
viewBy?: VisualizationObject.IVisualizationAttribute;
stackBy?: VisualizationObject.IVisualizationAttribute;
filters?: VisualizationObject.VisualizationObjectFilter[];
sortBy?: AFM.SortItem[];
}
Expand All @@ -39,11 +39,11 @@ export function AreaChart(props: IAreaChartProps): JSX.Element {
},
{
localIdentifier: 'attributes',
items: props.viewBy ? props.viewBy : []
items: props.viewBy ? [props.viewBy] : []
},
{
localIdentifier: 'stacks',
items: props.stackBy ? props.stackBy : []
items: props.stackBy ? [props.stackBy] : []
}
];

Expand Down
22 changes: 11 additions & 11 deletions stories/core_components/AreaChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ storiesOf('Core components/AreaChart', module)
<AreaChart
projectId="storybook"
measures={[MEASURE_1, MEASURE_2]}
viewBy={[ATTRIBUTE_1]}
viewBy={ATTRIBUTE_1}
onError={onErrorHandler}
LoadingComponent={null}
ErrorComponent={null}
Expand All @@ -36,7 +36,7 @@ storiesOf('Core components/AreaChart', module)
<AreaChart
projectId="storybook"
measures={[MEASURE_1, MEASURE_2]}
viewBy={[ATTRIBUTE_1]}
viewBy={ATTRIBUTE_1}
onError={onErrorHandler}
config={{
stacking: false
Expand All @@ -53,7 +53,7 @@ storiesOf('Core components/AreaChart', module)
<AreaChart
projectId="storybook"
measures={[MEASURE_1, MEASURE_2]}
viewBy={[ATTRIBUTE_1]}
viewBy={ATTRIBUTE_1}
onError={onErrorHandler}
config={{
stacking: true
Expand All @@ -70,8 +70,8 @@ storiesOf('Core components/AreaChart', module)
<AreaChart
projectId="storybook"
measures={[MEASURE_1]}
viewBy={[ATTRIBUTE_1]}
stackBy={[ATTRIBUTE_2]}
viewBy={ATTRIBUTE_1}
stackBy={ATTRIBUTE_2}
onError={onErrorHandler}
LoadingComponent={null}
ErrorComponent={null}
Expand All @@ -85,8 +85,8 @@ storiesOf('Core components/AreaChart', module)
<AreaChart
projectId="storybook"
measures={[MEASURE_1]}
viewBy={[ATTRIBUTE_1]}
stackBy={[ATTRIBUTE_2]}
viewBy={ATTRIBUTE_1}
stackBy={ATTRIBUTE_2}
onError={onErrorHandler}
config={{
stacking: false
Expand All @@ -103,7 +103,7 @@ storiesOf('Core components/AreaChart', module)
<AreaChart
projectId="storybook"
measures={[MEASURE_1, MEASURE_2]}
viewBy={[ATTRIBUTE_1]}
viewBy={ATTRIBUTE_1}
onError={onErrorHandler}
LoadingComponent={null}
ErrorComponent={null}
Expand All @@ -118,7 +118,7 @@ storiesOf('Core components/AreaChart', module)
<AreaChart
projectId="storybook"
measures={[MEASURE_1, MEASURE_2]}
viewBy={[ATTRIBUTE_1]}
viewBy={ATTRIBUTE_1}
onError={onErrorHandler}
LoadingComponent={null}
ErrorComponent={null}
Expand All @@ -132,7 +132,7 @@ storiesOf('Core components/AreaChart', module)
<AreaChart
projectId="storybook"
measures={[MEASURE_1, MEASURE_WITH_NULLS]}
viewBy={[ATTRIBUTE_1]}
viewBy={ATTRIBUTE_1}
onError={onErrorHandler}
LoadingComponent={null}
ErrorComponent={null}
Expand All @@ -145,7 +145,7 @@ storiesOf('Core components/AreaChart', module)
<AreaChart
projectId="storybook"
measures={[MEASURE_1, MEASURE_WITH_NULLS]}
viewBy={[ATTRIBUTE_1]}
viewBy={ATTRIBUTE_1}
onError={onErrorHandler}
config={{
stacking: false
Expand Down

0 comments on commit 02a8475

Please sign in to comment.