-
-
Notifications
You must be signed in to change notification settings - Fork 355
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
165 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
src/app/shared/components/markdown-tree/markdown-tree.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,3 @@ | ||
<div class="markdown-tree" #tree> | ||
|
||
</div> |
8 changes: 8 additions & 0 deletions
8
src/app/shared/components/markdown-tree/markdown-tree.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,8 @@ | ||
.markdown-tree { | ||
width: auto; | ||
height: auto; | ||
|
||
max-width: 800px; | ||
min-width: 600px; | ||
min-height: 400px; | ||
} |
25 changes: 25 additions & 0 deletions
25
src/app/shared/components/markdown-tree/markdown-tree.component.spec.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,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { MarkdownTreeComponent } from './markdown-tree.component'; | ||
|
||
describe('MarkdownTreeComponent', () => { | ||
let component: MarkdownTreeComponent; | ||
let fixture: ComponentFixture<MarkdownTreeComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ MarkdownTreeComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(MarkdownTreeComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
126 changes: 126 additions & 0 deletions
126
src/app/shared/components/markdown-tree/markdown-tree.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,126 @@ | ||
import {AfterViewInit, Component, ElementRef, OnInit, ViewChild} from '@angular/core'; | ||
import * as echarts from 'echarts'; | ||
|
||
@Component({ | ||
selector: 'component-markdown-tree', | ||
templateUrl: './markdown-tree.component.html', | ||
styleUrls: ['./markdown-tree.component.scss'] | ||
}) | ||
export class MarkdownTreeComponent implements OnInit, AfterViewInit { | ||
@ViewChild('tree', {}) treeElement: ElementRef; | ||
|
||
constructor() { | ||
|
||
} | ||
|
||
ngOnInit(): void { | ||
} | ||
|
||
ngAfterViewInit(): void { | ||
const myChart = echarts.init(this.treeElement.nativeElement); | ||
const data = { | ||
name: 'flare', | ||
children: [ | ||
{ | ||
name: 'data', | ||
children: [ | ||
{ | ||
name: 'converters', | ||
children: [ | ||
{name: 'Converters', value: 721}, | ||
{name: 'DelimitedTextConverter', value: 4294} | ||
] | ||
}, | ||
{ | ||
name: 'DataUtil', | ||
value: 3322 | ||
} | ||
] | ||
}, | ||
{ | ||
name: 'display', | ||
children: [ | ||
{name: 'DirtySprite', value: 8833}, | ||
{name: 'LineSprite', value: 1732}, | ||
{name: 'RectSprite', value: 3623} | ||
] | ||
}, | ||
{ | ||
name: 'flex', | ||
children: [ | ||
{name: 'FlareVis', value: 4116} | ||
] | ||
}, | ||
{ | ||
name: 'query', | ||
children: [] | ||
}, | ||
{ | ||
name: 'scale', | ||
children: [ | ||
{name: 'IScaleMap', value: 2105}, | ||
{name: 'LinearScale', value: 1316}, | ||
{name: 'LogScale', value: 3151}, | ||
{name: 'OrdinalScale', value: 3770}, | ||
{name: 'QuantileScale', value: 2435}, | ||
{name: 'QuantitativeScale', value: 4839}, | ||
{name: 'RootScale', value: 1756}, | ||
{name: 'Scale', value: 4268}, | ||
{name: 'ScaleType', value: 1821}, | ||
{name: 'TimeScale', value: 5833} | ||
] | ||
} | ||
] | ||
}; | ||
const options = { | ||
tooltip: { | ||
trigger: 'item', | ||
triggerOn: 'mousemove' | ||
}, | ||
series: [ | ||
{ | ||
type: 'tree', | ||
id: 0, | ||
name: 'tree1', | ||
data: [data], | ||
|
||
top: '10%', | ||
left: '8%', | ||
bottom: '22%', | ||
right: '20%', | ||
|
||
symbolSize: 7, | ||
|
||
edgeShape: 'polyline', | ||
edgeForkPosition: '63%', | ||
initialTreeDepth: 3, | ||
|
||
lineStyle: { | ||
width: 2 | ||
}, | ||
|
||
label: { | ||
backgroundColor: '#fff', | ||
position: 'left', | ||
verticalAlign: 'middle', | ||
align: 'right' | ||
}, | ||
|
||
leaves: { | ||
label: { | ||
position: 'right', | ||
verticalAlign: 'middle', | ||
align: 'left' | ||
} | ||
}, | ||
|
||
expandAndCollapse: true, | ||
animationDuration: 550, | ||
animationDurationUpdate: 750 | ||
} | ||
] | ||
}; | ||
|
||
myChart.setOption(options); | ||
} | ||
} |
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