-
-
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.
feat(heatmap): init featmap xaxis yaxis
- Loading branch information
Showing
4 changed files
with
83 additions
and
5 deletions.
There are no files selected for viewing
4 changes: 3 additions & 1 deletion
4
projects/ledge-render/src/lib/chart/ledge-heatmap/ledge-heatmap.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 |
---|---|---|
@@ -1 +1,3 @@ | ||
<p>ledge-heatmap works!</p> | ||
<div class="ledge-heatmap chart" #chart> | ||
|
||
</div> |
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,7 @@ | ||
.chart { | ||
width: auto; | ||
height: auto; | ||
min-width: 600px; | ||
min-height: 800px; | ||
max-width: 1600px; | ||
} |
73 changes: 69 additions & 4 deletions
73
projects/ledge-render/src/lib/chart/ledge-heatmap/ledge-heatmap.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 |
---|---|---|
@@ -1,15 +1,80 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { AfterViewInit, Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core'; | ||
import echarts from 'echarts'; | ||
|
||
import { LedgeTable } from '../../components/model/ledge-chart.model'; | ||
import LedgeChartConverter from '../../components/model/ledge-chart-converter'; | ||
|
||
@Component({ | ||
selector: 'app-ledge-heatmap', | ||
selector: 'ledge-heatmap', | ||
templateUrl: './ledge-heatmap.component.html', | ||
styleUrls: ['./ledge-heatmap.component.scss'] | ||
}) | ||
export class LedgeHeatmapComponent implements OnInit { | ||
export class LedgeHeatmapComponent implements OnInit, AfterViewInit { | ||
@Input() data: LedgeTable; | ||
|
||
@Input() config: any; | ||
|
||
constructor() { } | ||
@ViewChild('chart', {}) chartEl: ElementRef; | ||
|
||
constructor() { | ||
} | ||
|
||
ngOnInit(): void { | ||
} | ||
|
||
ngAfterViewInit(): void { | ||
const myChart = echarts.init(this.chartEl.nativeElement); | ||
const option = this.buildOption(this.data); | ||
myChart.setOption(option as any); | ||
} | ||
|
||
private buildOption(treeData: LedgeTable) { | ||
console.log(treeData); | ||
return { | ||
tooltip: { | ||
position: 'top' | ||
}, | ||
animation: false, | ||
grid: { | ||
height: '50%', | ||
top: '10%' | ||
}, | ||
xAxis: { | ||
type: 'category', | ||
data: treeData.header, | ||
splitArea: { | ||
show: true | ||
} | ||
}, | ||
yAxis: { | ||
type: 'category', | ||
data: treeData.cells[0].reverse(), | ||
splitArea: { | ||
show: true | ||
} | ||
}, | ||
visualMap: { | ||
min: 0, | ||
max: 10, | ||
calculable: true, | ||
orient: 'horizontal', | ||
left: 'center', | ||
bottom: '15%' | ||
}, | ||
series: [{ | ||
name: 'Punch Card', | ||
type: 'heatmap', | ||
data: [[0, 0, 3], [0, 1, 2]], | ||
label: { | ||
show: true | ||
}, | ||
emphasis: { | ||
itemStyle: { | ||
shadowBlur: 10, | ||
shadowColor: 'rgba(0, 0, 0, 0.5)' | ||
} | ||
} | ||
}] | ||
}; | ||
} | ||
} |
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