我想自定义图表的x轴...例如定义自己的x轴(例如,设置预定义值的数组或设置自己的x轴间隙等)
有一个函数示例吗?我查看了文档并实现了该功能,但它对我的x轴没有影响...:
formatDate(datestring : string) {
var monthNames = [
"Januar", "Februar", "März",
"April", "Mai", "Juni", "Juli",
"August", "September", "Oktober",
"November", "Dezember"
];
var dayNames = [
"Montag", "Dienstag", "Mittwoch",
"Donnerstag", "Freitag", "Samstag", "Sonntag"
]
var date = new Date(datestring);
var dayIndex = date.getDay();
var monthIndex = date.getMonth();
var year = date.getFullYear();
return dayNames[dayIndex] + 'HelloWorld ';
}
我的模板:
<ngx-charts-line-chart class="ResLineChart"
[view]=""
[scheme]="colorScheme"
[results]="ResLeistungChartData"
[gradient]="gradient"
[xAxis]="showXAxis"
[yAxis]="showYAxis"
[legend]="showLegend"
[showXAxisLabel]="showXAxisLabel"
[showYAxisLabel]="showYAxisLabel"
[xAxisLabel]="xAxisLabel"
[yAxisLabel]="yAxisLabel"
[tooltipDisabled]="tooltipDisabled"
[xAxisTickFormatting] = "formatDate"
[showGridLines]="true"
[rangeFillOpacity]="1"
[xAxisTicks] =""
[autoScale]="autoScale"
[yScaleMin]="resLeistungMin"
[yScaleMax]="resLeistungMax">
</ngx-charts-line-chart>
有人知道这种日期格式如何工作吗?还是网络上有任何有用的示例?