Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stacked Area chart #549

Merged
merged 42 commits into from
Jun 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
4f8f17c
add area chart component - basic
lucafalasco Mar 11, 2020
5fa0599
add area chart component - basic
lucafalasco Mar 11, 2020
5101c4c
feat(core): Axes configuration options defaultable, Add option to not…
SerenaG Feb 26, 2020
d1e42d4
Merge pull request #464 from accurat/storybook-in-core
ilariaventurini Mar 16, 2020
a611992
fix merge upstream
lucafalasco Mar 20, 2020
5f72078
Fix area options merge
SerenaG Mar 20, 2020
d298743
basic stacked area chart
lucafalasco Mar 24, 2020
c51e3af
remove spacing
lucafalasco Mar 25, 2020
035c8eb
add legend item hover
lucafalasco Mar 25, 2020
96c682a
refactor
lucafalasco Mar 25, 2020
f9a9c60
add event listeners
lucafalasco Mar 27, 2020
bc09c93
hide tooltip for now, clean up not used imports
lucafalasco Mar 31, 2020
68a553e
fix rebase
lucafalasco Mar 31, 2020
cdc1607
add mix-blend-mode
lucafalasco Apr 1, 2020
c0bb215
rename area > stacked-area
lucafalasco Apr 3, 2020
2d138cf
Fix area-stacked scss
SerenaG Apr 10, 2020
7084354
remove stroke
lucafalasco Apr 10, 2020
1bfadfe
fix rebase, use model.getStackedData
lucafalasco Apr 14, 2020
eb79a57
fix spaceOnEdges
lucafalasco Apr 14, 2020
e04316e
update area data to tabular format
lucafalasco Apr 16, 2020
30ee87f
fix legend highlighting
lucafalasco Apr 16, 2020
d7b85e6
add area stacked percentage
lucafalasco Apr 17, 2020
2baec38
add lines to stacked area chart
lucafalasco Apr 22, 2020
ffcc118
add ruler and tooltip
lucafalasco Apr 29, 2020
59add35
add wrappers for stacked area chart
lucafalasco Apr 30, 2020
4bfcfa4
hide lines when filtering is active
lucafalasco May 4, 2020
25991d8
Merge branch 'master' of github.com:carbon-design-system/carbon-chart…
theiliad May 29, 2020
02c978d
Merge branch 'master' of github.com:carbon-design-system/carbon-chart…
theiliad Jun 1, 2020
c513153
Merge branch 'area-chart' of github.com:accurat/carbon-charts into ar…
theiliad Jun 1, 2020
3370e05
feat(core, react, vue, angular): add stacked area chart
theiliad Jun 1, 2020
5c4a676
format code
theiliad Jun 1, 2020
c07a98c
Merge branch 'master' into area-chart
theiliad Jun 1, 2020
8998819
fix react wrapper for stacked area
theiliad Jun 1, 2020
9bb4fa1
Merge branch 'area-chart' of github.com:accurat/carbon-charts into ar…
theiliad Jun 1, 2020
a01d071
fix import for svelte stacked area
theiliad Jun 1, 2020
995dcd3
add fade-in flag in scatter graph
theiliad Jun 10, 2020
0c9f39b
format
theiliad Jun 10, 2020
b3bf9b1
Merge branch 'master' of github.com:carbon-design-system/carbon-chart…
theiliad Jun 10, 2020
a0b9d01
format
theiliad Jun 10, 2020
b2e8a25
Merge branch 'master' of github.com:carbon-design-system/carbon-chart…
theiliad Jun 10, 2020
6277696
Merge branch 'master' into area-chart
theiliad Jun 10, 2020
6c63ad2
Merge branch 'area-chart' of github.com:accurat/carbon-charts into ar…
theiliad Jun 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions packages/angular/src/area-chart-stacked.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import {
Component,
AfterViewInit
} from "@angular/core";

import { BaseChart } from "./base-chart.component";

import { StackedAreaChart } from "@carbon/charts";

/**
* Wrapper around `StackedAreaChart` in carbon charts library
*
* Most functions just call their equivalent from the chart library.
*/
@Component({
selector: "ibm-stacked-area-chart",
template: ``
})
export class StackedAreaChartComponent extends BaseChart implements AfterViewInit {
/**
* Runs after view init to create a chart, attach it to `elementRef` and draw it.
*/
ngAfterViewInit() {
this.chart = new StackedAreaChart(
this.elementRef.nativeElement,
{
data: this.data,
options: this.options
}
);

Object.assign(this, this.chart);
}
}
3 changes: 3 additions & 0 deletions packages/angular/src/charts.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { CommonModule } from "@angular/common";

import { BaseChart } from "./base-chart.component";
import { AreaChartComponent } from "./area-chart.component";
import { StackedAreaChartComponent } from "./area-chart-stacked.component";
import { SimpleBarChartComponent } from "./bar-chart-simple.component";
import { GroupedBarChartComponent } from "./bar-chart-grouped.component";
import { StackedBarChartComponent } from "./bar-chart-stacked.component";
Expand All @@ -20,6 +21,7 @@ import { RadarChartComponent } from "./radar-chart.component";
declarations: [
BaseChart,
AreaChartComponent,
StackedAreaChartComponent,
SimpleBarChartComponent,
GroupedBarChartComponent,
StackedBarChartComponent,
Expand All @@ -33,6 +35,7 @@ import { RadarChartComponent } from "./radar-chart.component";
exports: [
BaseChart,
AreaChartComponent,
StackedAreaChartComponent,
SimpleBarChartComponent,
GroupedBarChartComponent,
StackedBarChartComponent,
Expand Down
1 change: 1 addition & 0 deletions packages/angular/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export * from "./charts.module";

export * from "./base-chart.component";
export * from "./area-chart-stacked.component";
export * from "./bar-chart-simple.component";
export * from "./bar-chart-grouped.component";
export * from "./bar-chart-stacked.component";
Expand Down
36 changes: 6 additions & 30 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,55 +18,31 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

**Note:** Version bump only for package @carbon/charts





## [0.32.2](https://github.com/carbon-design-system/carbon-charts/compare/v0.32.1...v0.32.2) (2020-06-05)


### Bug Fixes

* **core, angular, react, vue, svelte:** fix scatter graph data updates ([#654](https://github.com/carbon-design-system/carbon-charts/issues/654)) ([673d627](https://github.com/carbon-design-system/carbon-charts/commit/673d627f47274b9815ef94e4a48bb25485e1b9a3))




- **core, angular, react, vue, svelte:** fix scatter graph data updates ([#654](https://github.com/carbon-design-system/carbon-charts/issues/654)) ([673d627](https://github.com/carbon-design-system/carbon-charts/commit/673d627f47274b9815ef94e4a48bb25485e1b9a3))

## [0.32.1](https://github.com/carbon-design-system/carbon-charts/compare/v0.32.0...v0.32.1) (2020-06-03)


### Bug Fixes

* fix missing title option in charts interface ([b74d658](https://github.com/carbon-design-system/carbon-charts/commit/b74d6582277632c8a2a1f460f3ce73aadd40e500))




- fix missing title option in charts interface ([b74d658](https://github.com/carbon-design-system/carbon-charts/commit/b74d6582277632c8a2a1f460f3ce73aadd40e500))

# [0.32.0](https://github.com/carbon-design-system/carbon-charts/compare/v0.30.24...v0.32.0) (2020-05-29)


### Bug Fixes

* **core:** threshold - support non JS-date values ([a132497](https://github.com/carbon-design-system/carbon-charts/commit/a1324972fa5266151b490cb7eeed92a92da5b2c4))
* **svelte:** copy svelte source to dist/src ([492a504](https://github.com/carbon-design-system/carbon-charts/commit/492a50470d2b64793bd2c67c4115bb2732bc44f7))




- **core:** threshold - support non JS-date values ([a132497](https://github.com/carbon-design-system/carbon-charts/commit/a1324972fa5266151b490cb7eeed92a92da5b2c4))
- **svelte:** copy svelte source to dist/src ([492a504](https://github.com/carbon-design-system/carbon-charts/commit/492a50470d2b64793bd2c67c4115bb2732bc44f7))

# [0.31.0](https://github.com/carbon-design-system/carbon-charts/compare/v0.30.24...v0.31.0) (2020-05-29)


### Bug Fixes

* **core:** threshold - support non JS-date values ([a132497](https://github.com/carbon-design-system/carbon-charts/commit/a1324972fa5266151b490cb7eeed92a92da5b2c4))
* **svelte:** copy svelte source to dist/src ([492a504](https://github.com/carbon-design-system/carbon-charts/commit/492a50470d2b64793bd2c67c4115bb2732bc44f7))




- **core:** threshold - support non JS-date values ([a132497](https://github.com/carbon-design-system/carbon-charts/commit/a1324972fa5266151b490cb7eeed92a92da5b2c4))
- **svelte:** copy svelte source to dist/src ([492a504](https://github.com/carbon-design-system/carbon-charts/commit/492a50470d2b64793bd2c67c4115bb2732bc44f7))

## [0.30.24](https://github.com/carbon-design-system/carbon-charts/compare/v0.30.23...v0.30.24) (2020-05-15)

Expand Down
3 changes: 2 additions & 1 deletion packages/core/demo/create-codesandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { getParameters } from "codesandbox/lib/api/define";

const packageJSON = require("@carbon/charts/package.json");
const libraryVersion = packageJSON.version;
const carbonComponentsVersion = packageJSON.devDependencies["carbon-components"];
const carbonComponentsVersion =
packageJSON.devDependencies["carbon-components"];

const ibmPlexFontCSS = `@import "https://fonts.googleapis.com/css?family=IBM+Plex+Sans+Condensed|IBM+Plex+Sans:400,600&display=swap";
`;
Expand Down
115 changes: 82 additions & 33 deletions packages/core/demo/data/area.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
export const areaTimeSeriesData = [
{ group: "Dataset 1", date: new Date(2019, 0, 1), value: 0 },
{ group: "Dataset 1", date: new Date(2019, 0, 6), value: 57312 },
{ group: "Dataset 1", date: new Date(2019, 0, 8), value: 21432 },
{ group: "Dataset 1", date: new Date(2019, 0, 15), value: 70323 },
{ group: "Dataset 1", date: new Date(2019, 0, 19), value: 21300 },
{ group: "Dataset 2", date: new Date(2019, 0, 1), value: 50000 },
{ group: "Dataset 2", date: new Date(2019, 0, 5), value: 15000 },
{ group: "Dataset 2", date: new Date(2019, 0, 8), value: 20000 },
{ group: "Dataset 2", date: new Date(2019, 0, 13), value: 39213 },
{ group: "Dataset 2", date: new Date(2019, 0, 19), value: 61213 },
{ group: "Dataset 3", date: new Date(2019, 0, 2), value: 10 },
{ group: "Dataset 3", date: new Date(2019, 0, 6), value: 37312 },
{ group: "Dataset 3", date: new Date(2019, 0, 8), value: 51432 },
{ group: "Dataset 3", date: new Date(2019, 0, 13), value: 40323 },
{ group: "Dataset 3", date: new Date(2019, 0, 19), value: 31300 }
{ group: "Dataset 1", date: new Date(2019, 0, 1), value: 0 },
{ group: "Dataset 1", date: new Date(2019, 0, 6), value: 57312 },
{ group: "Dataset 1", date: new Date(2019, 0, 8), value: 21432 },
{ group: "Dataset 1", date: new Date(2019, 0, 15), value: 70323 },
{ group: "Dataset 1", date: new Date(2019, 0, 19), value: 21300 },
{ group: "Dataset 2", date: new Date(2019, 0, 1), value: 50000 },
{ group: "Dataset 2", date: new Date(2019, 0, 5), value: 15000 },
{ group: "Dataset 2", date: new Date(2019, 0, 8), value: 20000 },
{ group: "Dataset 2", date: new Date(2019, 0, 13), value: 39213 },
{ group: "Dataset 2", date: new Date(2019, 0, 19), value: 61213 },
{ group: "Dataset 3", date: new Date(2019, 0, 2), value: 10 },
{ group: "Dataset 3", date: new Date(2019, 0, 6), value: 37312 },
{ group: "Dataset 3", date: new Date(2019, 0, 8), value: 51432 },
{ group: "Dataset 3", date: new Date(2019, 0, 13), value: 40323 },
{ group: "Dataset 3", date: new Date(2019, 0, 19), value: 31300 },
];

export const areaTimeSeriesOptions = {
Expand All @@ -22,27 +22,27 @@ export const areaTimeSeriesOptions = {
bottom: {
title: "2019 Annual Sales Figures",
mapsTo: "date",
scaleType: "time"
scaleType: "time",
},
left: {
mapsTo: "value",
title: "Conversion rate",
scaleType: "linear"
}
}
scaleType: "linear",
},
},
};

export const areaTimeSeriesCurvedData = [
{ group: "Dataset 1", date: new Date(2019, 0, 1), value: 0 },
{ group: "Dataset 1", date: new Date(2019, 0, 6), value: -37312 },
{ group: "Dataset 1", date: new Date(2019, 0, 8), value: -22392 },
{ group: "Dataset 1", date: new Date(2019, 0, 15), value: -52576 },
{ group: "Dataset 1", date: new Date(2019, 0, 19), value: 20135 },
{ group: "Dataset 2", date: new Date(2019, 0, 1), value: 47263 },
{ group: "Dataset 2", date: new Date(2019, 0, 5), value: 14178 },
{ group: "Dataset 2", date: new Date(2019, 0, 8), value: 23094 },
{ group: "Dataset 2", date: new Date(2019, 0, 13), value: 45281 },
{ group: "Dataset 2", date: new Date(2019, 0, 19), value: -63954 }
{ group: "Dataset 1", date: new Date(2019, 0, 1), value: 0 },
{ group: "Dataset 1", date: new Date(2019, 0, 6), value: -37312 },
{ group: "Dataset 1", date: new Date(2019, 0, 8), value: -22392 },
{ group: "Dataset 1", date: new Date(2019, 0, 15), value: -52576 },
{ group: "Dataset 1", date: new Date(2019, 0, 19), value: 20135 },
{ group: "Dataset 2", date: new Date(2019, 0, 1), value: 47263 },
{ group: "Dataset 2", date: new Date(2019, 0, 5), value: 14178 },
{ group: "Dataset 2", date: new Date(2019, 0, 8), value: 23094 },
{ group: "Dataset 2", date: new Date(2019, 0, 13), value: 45281 },
{ group: "Dataset 2", date: new Date(2019, 0, 19), value: -63954 },
];

export const areaTimeSeriesCurvedOptions = {
Expand All @@ -51,12 +51,61 @@ export const areaTimeSeriesCurvedOptions = {
bottom: {
title: "2019 Annual Sales Figures",
mapsTo: "date",
scaleType: "time"
scaleType: "time",
},
left: {
mapsTo: "value",
scaleType: "linear"
}
scaleType: "linear",
},
},
curve: "curveNatural",
};

export const stackedAreaTimeSeriesData = [
{ group: "Dataset 1", date: new Date(2019, 0, 1), value: 10000 },
{ group: "Dataset 1", date: new Date(2019, 0, 5), value: 65000 },
{ group: "Dataset 1", date: new Date(2019, 0, 8), value: 10000 },
{ group: "Dataset 1", date: new Date(2019, 0, 13), value: 49213 },
{ group: "Dataset 1", date: new Date(2019, 0, 17), value: 51213 },
{ group: "Dataset 2", date: new Date(2019, 0, 1), value: 20000 },
{ group: "Dataset 2", date: new Date(2019, 0, 5), value: 25000 },
{ group: "Dataset 2", date: new Date(2019, 0, 8), value: 60000 },
{ group: "Dataset 2", date: new Date(2019, 0, 13), value: 30213 },
{ group: "Dataset 2", date: new Date(2019, 0, 17), value: 55213 },
{ group: "Dataset 3", date: new Date(2019, 0, 1), value: 30000 },
{ group: "Dataset 3", date: new Date(2019, 0, 5), value: 20000 },
{ group: "Dataset 3", date: new Date(2019, 0, 8), value: 40000 },
{ group: "Dataset 3", date: new Date(2019, 0, 13), value: 60213 },
{ group: "Dataset 3", date: new Date(2019, 0, 17), value: 25213 },
];

export const stackedAreaTimeSeriesOptions = {
title: "Stacked area (time series)",
axes: {
left: {
stacked: true,
},
bottom: {
scaleType: "time",
},
},
curve: "curveMonotoneX",
};

export const stackedAreaPercentageTimeSeriesOptions = {
title: "Stacked area (percentage)",
axes: {
left: {
domain: [0, 100],
stacked: true,
ticks: {
formatter: (d) => `${d}%`,
},
},
bottom: {
scaleType: "time",
},
},
curve: "curveNatural"
percentage: true,
curve: "curveMonotoneX",
};
Loading