Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
feat(sunburst-chart): Added sunburst-chart component.
Browse files Browse the repository at this point in the history
  • Loading branch information
subarroca authored and ffriedl89 committed Apr 30, 2020
1 parent 3c996f5 commit e929e09
Show file tree
Hide file tree
Showing 46 changed files with 3,098 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
/libs/barista-components/selection-area/** @ffriedl89 @lukasholzer
/libs/barista-components/show-more/** @rowa-audil
/libs/barista-components/stepper/** @ffriedl89 @thomaspink
/libs/barista-components/sunburst-chart/** @subarroca @pedromosquera
/libs/barista-components/switch/** @thomaspink
/libs/barista-components/table/** @ffriedl89 @tomheller
/libs/barista-components/tabs/** @ffriedl89 @thomaspink
Expand Down Expand Up @@ -144,6 +145,7 @@
/apps/dev/src/selection-area/** @ffriedl89 @lukasholzer
/apps/dev/src/show-more/** @rowa-audil
/apps/dev/src/stepper/** @ffriedl89 @thomaspink
/apps/dev/src/sunburst-chart/** @subarroca
/apps/dev/src/switch/** @thomaspink
/apps/dev/src/table/** @ffriedl89 @tomheller
/apps/dev/src/tabs/** @ffriedl89 @thomaspink
Expand Down
44 changes: 44 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -2956,6 +2956,50 @@
},
"schematics": {}
},
"sunburst-chart": {
"projectType": "library",
"root": "libs/barista-components/sunburst-chart",
"sourceRoot": "libs/barista-components/sunburst-chart/src",
"prefix": "dynatrace",
"architect": {
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"libs/barista-components/sunburst-chart/tsconfig.lib.json",
"libs/barista-components/sunburst-chart/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**",
"!libs/barista-components/sunburst-chart/**"
]
}
},
"lint-styles": {
"builder": "./dist/libs/workspace:stylelint",
"options": {
"stylelintConfig": ".stylelintrc",
"reportFile": "dist/stylelint/report.xml",
"exclude": ["**/node_modules/**"],
"files": ["libs/barista-components/sunburst-chart/**/*.scss"]
}
},
"test": {
"builder": "@nrwl/jest:jest",
"options": {
"jestConfig": "libs/barista-components/sunburst-chart/jest.config.js",
"tsConfig": "libs/barista-components/sunburst-chart/tsconfig.spec.json",
"passWithNoTests": true,
"setupFile": "libs/barista-components/sunburst-chart/src/test-setup.ts"
}
}
},
"schematics": {
"@nrwl/angular:component": {
"styleext": "scss"
}
}
},
"switch": {
"projectType": "library",
"root": "libs/barista-components/switch",
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 @@ -77,6 +77,7 @@ import { ShowMoreDemo } from './show-more/show-more-demo.component';
import { SidenavDemo } from './sidenav/sidenav-demo.component';
import { StepperDemo } from './stepper/stepper-demo.component';
import { SliderDemo } from './slider/slider-demo.component';
import { SunburstChartDemo } from './sunburst-chart/sunburst-chart-demo.component';
import { SwitchDemo } from './switch/switch-demo.component';
import { TableDemo } from './table/table-demo.component';
import { TabsDemo } from './tabs/tabs-demo.component';
Expand Down Expand Up @@ -145,6 +146,7 @@ export class NoopRouteComponent {}
SecondaryNavDemo,
SelectDemo,
ShowMoreDemo,
SunburstChartDemo,
SwitchDemo,
TableDemo,
TabsDemo,
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 @@ -65,6 +65,7 @@ import { ShowMoreDemo } from './show-more/show-more-demo.component';
import { SidenavDemo } from './sidenav/sidenav-demo.component';
import { StepperDemo } from './stepper/stepper-demo.component';
import { SliderDemo } from './slider/slider-demo.component';
import { SunburstChartDemo } from './sunburst-chart/sunburst-chart-demo.component';
import { SwitchDemo } from './switch/switch-demo.component';
import { TableDemo } from './table/table-demo.component';
import { TabsDemo } from './tabs/tabs-demo.component';
Expand Down Expand Up @@ -122,6 +123,7 @@ const routes: Routes = [
{ path: 'select', component: SelectDemo },
{ path: 'show-more', component: ShowMoreDemo },
{ path: 'stepper', component: StepperDemo },
{ path: 'sunburst-chart', component: SunburstChartDemo },
{ path: 'switch', component: SwitchDemo },
{ path: 'table', component: TableDemo },
{ path: 'tabs', component: TabsDemo },
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 @@ -90,6 +90,7 @@ export class DevApp implements AfterContentInit, OnDestroy {
{ name: 'Show-more', route: '/show-more' },
{ name: 'Stepper', route: '/stepper' },
{ name: 'Slider', route: '/slider' },
{ name: 'Sunburst-chart', route: '/sunburst-chart' },
{ name: 'Switch', route: '/switch' },
{ name: 'Table', route: '/table' },
{ name: 'Tabs', route: '/tabs' },
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 @@ -62,6 +62,7 @@ import { DtSelectModule } from '@dynatrace/barista-components/select';
import { DtShowMoreModule } from '@dynatrace/barista-components/show-more';
import { DtStepperModule } from '@dynatrace/barista-components/stepper';
import { DtSliderModule } from '@dynatrace/barista-components/slider';
import { DtSunburstChartModule } from '@dynatrace/barista-components/sunburst-chart';
import { DtSwitchModule } from '@dynatrace/barista-components/switch';
import { DtTableModule } from '@dynatrace/barista-components/table';
import { DtTabsModule } from '@dynatrace/barista-components/tabs';
Expand Down Expand Up @@ -116,6 +117,7 @@ import { DtTreeTableModule } from '@dynatrace/barista-components/tree-table';
DtSecondaryNavModule,
DtSelectModule,
DtShowMoreModule,
DtSunburstChartModule,
DtSwitchModule,
DtTableModule,
DtTabsModule,
Expand Down
138 changes: 138 additions & 0 deletions apps/dev/src/sunburst-chart/sunburst-chart-demo-data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
/**
* @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 { DtColors } from '@dynatrace/barista-components/theming';

export const sunburstChartDemoData = [
{
// value: 4,
label: 'Locke',
children: [
{
value: 2,
label: 'John',
},
{
value: 1,
label: 'Terry',
},
{
value: 1,
label: "O'Quinn",
},
],
},
{
// value: 8,
label: 'Reyes',
children: [
{
value: 4,
label: 'Hugo',
},
{
value: 2,
label: 'Jorge',
},
{
value: 2,
label: 'Garcia',
},
],
},
{
// value: 15,
label: 'Ford',
children: [
{
value: 8,
label: 'James',
},
{
value: 4,
label: 'Josh',
},
{
value: 3,
label: 'Holloway',
},
],
},
{
// value: 16,
label: 'Jarrah',
color: DtColors.SHAMROCKGREEN_500,
children: [
{
value: 8,
label: 'Sayid',
},
{
value: 4,
label: 'Naveen',
},
{
value: 4,
label: 'Andrews',
},
],
},
{
// value: 23,
label: 'Shephard',
children: [
{
value: 15,
label: 'Jack',
},
{
value: 4,
label: 'Matthew',
},
{
value: 4,
label: 'Fox',
},
],
},
{
// value: 42,
label: 'Kwon',
children: [
{
value: 15,
label: 'Jin',
},
{
label: 'Daniel Dae',
children: [
{
value: 15,
label: 'Daniel',
},
{
value: 8,
label: 'Dae',
},
],
},
{
value: 4,
label: 'Kim',
},
],
},
];
16 changes: 16 additions & 0 deletions apps/dev/src/sunburst-chart/sunburst-chart-demo.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<dt-sunburst-chart
noSelectionLabel="All"
[series]="series"
[selected]="selectedInitial"
(selectedChange)="select($event)"
[valueDisplayMode]="valueDisplayMode"
>
<ng-template dtSunburstChartOverlay let-tooltip>
{{ tooltip.label }}: {{ tooltip.value }}
</ng-template>
</dt-sunburst-chart>

<dt-switch (change)="toggleDisplayMode($event)">
Show relative values
</dt-switch>
<pre>{{ selected | json }}</pre>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:host {
display: block;
}
41 changes: 41 additions & 0 deletions apps/dev/src/sunburst-chart/sunburst-chart-demo.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* @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 { DtSunburstChartNode } from '@dynatrace/barista-components/sunburst-chart';
import { DtSwitchChange } from '@dynatrace/barista-components/switch';
import { sunburstChartDemoData } from './sunburst-chart-demo-data';

@Component({
selector: 'sunburst-chart-dev-app-demo',
templateUrl: './sunburst-chart-demo.component.html',
styleUrls: ['./sunburst-chart-demo.component.scss'],
})
export class SunburstChartDemo {
selectedInitial: DtSunburstChartNode[] = [sunburstChartDemoData[4]];
selected: string[];
valueDisplayMode: 'absolute' | 'percent' = 'absolute';

series = sunburstChartDemoData;

select(selected: DtSunburstChartNode[] = []): void {
this.selected = selected.map(node => node.label);
}

toggleDisplayMode(event: DtSwitchChange<boolean>): void {
this.valueDisplayMode = event.checked ? 'percent' : 'absolute';
}
}
Loading

0 comments on commit e929e09

Please sign in to comment.