-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(stacked-bar-chart): Create component
- Loading branch information
Showing
51 changed files
with
3,783 additions
and
3 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
apps/dev/src/stacked-bar-chart/stacked-bar-chart-demo-data.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}, | ||
], | ||
}, | ||
]; |
70 changes: 70 additions & 0 deletions
70
apps/dev/src/stacked-bar-chart/stacked-bar-chart-demo.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
11 changes: 11 additions & 0 deletions
11
apps/dev/src/stacked-bar-chart/stacked-bar-chart-demo.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
55
apps/dev/src/stacked-bar-chart/stacked-bar-chart-demo.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.