希望大家过得愉快。
我已经使用ng2-chart构建了此图表:
这是html代码:
<div style="display: block;">
<canvas
baseChart
[datasets]="scatterChartData"
[options]="scatterChartOptions"
[chartType]="scatterChartType"
>
</canvas>
</div>
这是相关的打字稿代码:
export class CartographieDesRisquesComponent implements OnInit {
constructor() {}
public scatterChartOptions: ChartOptions = {
responsive: true,
scales : {
yAxes: [{
}],
xAxes: [{
type:'time'
}],
},
};
我已经在文档和文件(来自下载的ng2-chart模块)中进行了搜索,该文件包含可以在x和y轴定义中使用的选项。
interface CommonAxe {
bounds?: string;
type?: ScaleType | string;
display?: boolean;
id?: string;
stacked?: boolean;
position?: string;
ticks?: TickOptions;
gridLines?: GridLineOptions;
barThickness?: number | "flex";
maxBarThickness?: number;
scaleLabel?: ScaleTitleOptions;
time?: TimeScale;
offset?: boolean;
beforeUpdate?(scale?: any): void;
beforeSetDimension?(scale?: any): void;
beforeDataLimits?(scale?: any): void;
beforeBuildTicks?(scale?: any): void;
beforeTickToLabelConversion?(scale?: any): void;
beforeCalculateTickRotation?(scale?: any): void;
beforeFit?(scale?: any): void;
afterUpdate?(scale?: any): void;
afterSetDimension?(scale?: any): void;
afterDataLimits?(scale?: any): void;
afterBuildTicks?(scale?: any): void;
afterTickToLabelConversion?(scale?: any): void;
afterCalculateTickRotation?(scale?: any): void;
afterFit?(scale?: any): void;
}
但是我找不到如何显示X和Y轴名称。
感谢您的帮助。