Skip to content

Commit

Permalink
feat(stacked-series-chart): Create component
Browse files Browse the repository at this point in the history
  • Loading branch information
subarroca committed May 21, 2020
1 parent 951d0a7 commit 7592278
Show file tree
Hide file tree
Showing 90 changed files with 7,284 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
/libs/barista-components/select/** @thomaspink
/libs/barista-components/selection-area/** @ffriedl89 @lukasholzer
/libs/barista-components/show-more/** @rowa-audil
/libs/barista-components/stacked-series-chart/** @subarroca @airime
/libs/barista-components/stepper/** @ffriedl89 @thomaspink
/libs/barista-components/sunburst-chart/** @subarroca @pedromosquera
/libs/barista-components/switch/** @thomaspink
Expand Down Expand Up @@ -144,6 +145,7 @@
/apps/dev/src/select/** @thomaspink
/apps/dev/src/selection-area/** @ffriedl89 @lukasholzer
/apps/dev/src/show-more/** @rowa-audil
/apps/dev/src/stacked-series-chart/** @subarroca @airime
/apps/dev/src/stepper/** @ffriedl89 @thomaspink
/apps/dev/src/sunburst-chart/** @subarroca
/apps/dev/src/switch/** @thomaspink
Expand Down
40 changes: 40 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -3045,6 +3045,46 @@
},
"schematics": {}
},
"stacked-series-chart": {
"projectType": "library",
"root": "libs/barista-components/stacked-series-chart",
"sourceRoot": "libs/barista-components/stacked-series-chart/src",
"prefix": "dt",
"architect": {
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"libs/barista-components/stacked-series-chart/tsconfig.lib.json",
"libs/barista-components/stacked-series-chart/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**",
"!libs/barista-components/stacked-series-chart/**"
]
}
},
"lint-styles": {
"builder": "./dist/libs/workspace:stylelint",
"options": {
"stylelintConfig": ".stylelintrc",
"reportFile": "dist/stylelint/report.xml",
"exclude": ["**/node_modules/**"],
"files": ["libs/barista-components/stacked-series-chart/**/*.scss"]
}
},
"test": {
"builder": "@nrwl/jest:jest",
"options": {
"jestConfig": "libs/barista-components/stacked-series-chart/jest.config.js",
"tsConfig": "libs/barista-components/stacked-series-chart/tsconfig.spec.json",
"setupFile": "libs/barista-components/stacked-series-chart/src/test-setup.ts",
"passWithNoTests": true
}
}
},
"schematics": {}
},
"stepper": {
"projectType": "library",
"root": "libs/barista-components/stepper",
Expand Down
2 changes: 2 additions & 0 deletions apps/dev/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import { RadioDemo } from './radio/radio-demo.component';
import { SecondaryNavDemo } from './secondary-nav/secondary-nav-demo.component';
import { SelectDemo } from './select/select-demo.component';
import { ShowMoreDemo } from './show-more/show-more-demo.component';
import { StackedSeriesChartDemo } from './stacked-series-chart/stacked-series-chart-demo.component';
import { SidenavDemo } from './sidenav/sidenav-demo.component';
import { StepperDemo } from './stepper/stepper-demo.component';
import { SliderDemo } from './slider/slider-demo.component';
Expand Down Expand Up @@ -145,6 +146,7 @@ export class NoopRouteComponent {}
SecondaryNavDemo,
SelectDemo,
ShowMoreDemo,
StackedSeriesChartDemo,
SunburstChartDemo,
SwitchDemo,
TableDemo,
Expand Down
2 changes: 2 additions & 0 deletions apps/dev/src/devapp-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import { RadioDemo } from './radio/radio-demo.component';
import { SecondaryNavDemo } from './secondary-nav/secondary-nav-demo.component';
import { SelectDemo } from './select/select-demo.component';
import { ShowMoreDemo } from './show-more/show-more-demo.component';
import { StackedSeriesChartDemo } from './stacked-series-chart/stacked-series-chart-demo.component';
import { SidenavDemo } from './sidenav/sidenav-demo.component';
import { StepperDemo } from './stepper/stepper-demo.component';
import { SliderDemo } from './slider/slider-demo.component';
Expand Down Expand Up @@ -122,6 +123,7 @@ const routes: Routes = [
{ path: 'secondary-nav', component: SecondaryNavDemo },
{ path: 'select', component: SelectDemo },
{ path: 'show-more', component: ShowMoreDemo },
{ path: 'stacked-series-chart', component: StackedSeriesChartDemo },
{ path: 'stepper', component: StepperDemo },
{ path: 'sunburst-chart', component: SunburstChartDemo },
{ path: 'switch', component: SwitchDemo },
Expand Down
1 change: 1 addition & 0 deletions apps/dev/src/devapp.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export class DevApp implements AfterContentInit, OnDestroy {
{ name: 'Secondary-nav', route: '/secondary-nav' },
{ name: 'Select', route: '/select' },
{ name: 'Show-more', route: '/show-more' },
{ name: 'Stacked-series-chart', route: '/stacked-series-chart' },
{ name: 'Stepper', route: '/stepper' },
{ name: 'Slider', route: '/slider' },
{ name: 'Sunburst-chart', route: '/sunburst-chart' },
Expand Down
2 changes: 2 additions & 0 deletions apps/dev/src/dt-components.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ import { DtRadioModule } from '@dynatrace/barista-components/radio';
import { DtSecondaryNavModule } from '@dynatrace/barista-components/secondary-nav';
import { DtSelectModule } from '@dynatrace/barista-components/select';
import { DtShowMoreModule } from '@dynatrace/barista-components/show-more';
import { DtStackedSeriesChartModule } from '@dynatrace/barista-components/stacked-series-chart';
import { DtStepperModule } from '@dynatrace/barista-components/stepper';
import { DtSliderModule } from '@dynatrace/barista-components/slider';
import { DtSunburstChartModule } from '@dynatrace/barista-components/sunburst-chart';
Expand Down Expand Up @@ -117,6 +118,7 @@ import { DtTreeTableModule } from '@dynatrace/barista-components/tree-table';
DtSecondaryNavModule,
DtSelectModule,
DtShowMoreModule,
DtStackedSeriesChartModule,
DtSunburstChartModule,
DtSwitchModule,
DtTableModule,
Expand Down
70 changes: 70 additions & 0 deletions apps/dev/src/stacked-bar-chart/stacked-bar-chart-demo-data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/**
* @license
* Copyright 2020 Dynatrace LLC
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export const stackedBarChartDemoData = [
{
label: 'Espresso',
nodes: [
{
value: 1,
label: 'Coffee',
},
],
},
{
label: 'Macchiato',
nodes: [
{
value: 2,
label: 'Coffee',
},
{
value: 1,
label: 'Milk',
},
],
},
{
label: 'Americano',
nodes: [
{
value: 2,
label: 'Coffee',
},
{
value: 3,
label: 'Water',
},
],
},
{
label: 'Mocha',
nodes: [
{
value: 2,
label: 'Coffee',
},
{
value: 2,
label: 'Chocolate',
},
{
value: 1,
label: 'Milk',
},
],
},
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<dt-stacked-bar-chart
[series]="series"
[selectable]="selectable"
[(selected)]="selected"
[valueDisplayMode]="valueDisplayMode"
[visibleLabel]="visibleLabel"
[visibleLegend]="visibleLegend"
[fillMode]="fillMode"
[mode]="mode"
[maxTrackSize]="maxTrackSize"
[visibleTrackBackground]="visibleTrackBackground"
[class]="mode"
>
<ng-template dtStackedBarChartOverlay let-tooltip>
<strong>{{ tooltip.seriesOrigin.label }}</strong>
<div>{{ tooltip.origin.label }}: {{ tooltip.origin.value }}</div>
</ng-template>
</dt-stacked-bar-chart>

<h2>Demo controls</h2>

<h3>Mode</h3>
<dt-button-group [(value)]="mode">
<dt-button-group-item value="bar">Bar</dt-button-group-item>
<dt-button-group-item value="column">Column</dt-button-group-item>
</dt-button-group>

<h3>Label</h3>
<dt-switch [(ngModel)]="visibleLabel">Visible</dt-switch>

<h3>Track</h3>
<h4>Background</h4>
<dt-switch [(ngModel)]="visibleTrackBackground">Visible</dt-switch>

<h4>Max size</h4>
<dt-button-group [(value)]="maxTrackSize">
<dt-button-group-item value="">None</dt-button-group-item>
<dt-button-group-item value="8">8</dt-button-group-item>
<dt-button-group-item value="16">16</dt-button-group-item>
<dt-button-group-item value="32">32</dt-button-group-item>
<dt-button-group-item value="1000">1000</dt-button-group-item>
</dt-button-group>

<h3>Interactivity</h3>
<dt-switch [(ngModel)]="selectable">Selectable</dt-switch>

<h3>Legend</h3>
<dt-switch [(ngModel)]="visibleLegend">Visible</dt-switch>

<h3>Fill mode</h3>
<dt-button-group [(value)]="fillMode">
<dt-button-group-item value="full">Full</dt-button-group-item>
<dt-button-group-item value="relative">Relative</dt-button-group-item>
</dt-button-group>

<h3>Amount of series</h3>
<dt-switch [ngModel]="multiSeries" (ngModelChange)="toggleSeries($event)"
>Multiple</dt-switch
>

<ng-container *ngIf="!multiSeries">
<h3>
Legend value (only for single bar)
</h3>
<dt-button-group [(value)]="valueDisplayMode">
<dt-button-group-item value="none">None</dt-button-group-item>
<dt-button-group-item value="absolute">Absolute</dt-button-group-item>
<dt-button-group-item value="percent">Percent</dt-button-group-item>
</dt-button-group>
</ng-container>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
:host {
display: block;
}

dt-stacked-bar-chart {
margin-bottom: 40px;

&.column {
min-height: 200px;
}
}
55 changes: 55 additions & 0 deletions apps/dev/src/stacked-bar-chart/stacked-bar-chart-demo.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* @license
* Copyright 2020 Dynatrace LLC
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { Component } from '@angular/core';
import {
DtStackedBarChartFillMode,
DtStackedBarChartMode,
DtStackedBarChartNode,
DtStackedBarChartSeries,
DtStackedBarChartValueDisplayMode,
} from '@dynatrace/barista-components/stacked-bar-chart';
import { stackedBarChartDemoData } from './stacked-bar-chart-demo-data';

@Component({
selector: 'stacked-bar-chart-dev-app-demo',
templateUrl: './stacked-bar-chart-demo.component.html',
styleUrls: ['./stacked-bar-chart-demo.component.scss'],
})
export class StackedBarChartDemo {
selectable: boolean = true;
selected: [DtStackedBarChartSeries, DtStackedBarChartNode] = [
stackedBarChartDemoData[3],
stackedBarChartDemoData[3].nodes[1],
];
valueDisplayMode: DtStackedBarChartValueDisplayMode = 'absolute';
visibleLabel: boolean = true;
visibleLegend: boolean = true;
fillMode: DtStackedBarChartFillMode = 'relative';
multiSeries = true;
mode: DtStackedBarChartMode = 'bar';
maxTrackSize: number = 16;
visibleTrackBackground: boolean = true;

series = stackedBarChartDemoData;

toggleSeries(multi: boolean): void {
this.multiSeries = multi;
this.series = multi
? stackedBarChartDemoData
: [stackedBarChartDemoData[3]];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/**
* @license
* Copyright 2020 Dynatrace LLC
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export const stackedSeriesChartDemoData = [
{
label: 'Espresso',
nodes: [
{
value: 1,
label: 'Coffee',
},
],
},
{
label: 'Macchiato',
nodes: [
{
value: 2,
label: 'Coffee',
},
{
value: 1,
label: 'Milk',
},
],
},
{
label: 'Americano',
nodes: [
{
value: 2,
label: 'Coffee',
},
{
value: 3,
label: 'Water',
},
],
},
{
label: 'Mocha',
nodes: [
{
value: 2,
label: 'Coffee',
},
{
value: 2,
label: 'Chocolate',
},
{
value: 1,
label: 'Milk',
},
],
},
];

0 comments on commit 7592278

Please sign in to comment.