我需要从x轴上删除日期(最坏的情况),最好将蜡烛图ng2-charts中的类型从日期更改为字符串 (https://valor-software.com/ng2-charts/#FinancialChart)
该html文件为:
<div class="chart">
<canvas baseChart [datasets]="financialChartData" [options]="financialChartOptions"
[colors]="financialChartColors" [legend]="financialChartLegend" [chartType]="financialChartType">
</canvas>
</div>
ts文件是:
@Component({
selector: 'app-candle-chart',
templateUrl: './candle-chart.component.html',
styleUrls: ['./candle-chart.component.css']
})
export class CandleChartComponent implements OnInit {
initialDateStr = '';
public financialChartData = [
{
label: 'Heavy Load',
data: [{t:0,o:0,l:0,h:0,c:0},
{t:1,o:10,l:5,h:100,c:20},
{t:2,o:15,l:10,h:74,c:5},
{t:3,o:45,l:23,h:89,c:25},
{t:4,o:0,l:0,h:0,c:0},]
}
];
public financialChartOptions: ChartOptions = {
responsive: true,
maintainAspectRatio: true,
};
public financialChartColors: Color[] = [
{
borderColor: 'black',
backgroundColor: 'rgba(255,0,0,0.3)',
},
];
public financialChartLegend = true;
public financialChartType = 'candlestick';
@ViewChild(BaseChartDirective) chart: BaseChartDirective;
constructor() { }
ngOnInit() {
}
}
我正在搜索文档,但找不到
提前谢谢