Angular 剑道图-在同一系列上更改单个标记的类型、大小和边框颜色
我有一个剑道折线图,每个数据点需要有不同的标记样式 我有以下模板(markerType、大小和边框颜色是硬编码的,我正在尝试使其动态化) 行项目如下所示Angular 剑道图-在同一系列上更改单个标记的类型、大小和边框颜色,angular,kendo-ui-angular2,Angular,Kendo Ui Angular2,我有一个剑道折线图,每个数据点需要有不同的标记样式 我有以下模板(markerType、大小和边框颜色是硬编码的,我正在尝试使其动态化) 行项目如下所示 export interface LineItem { category: string values: number marker: Marker } export interface Marker { size: number type: MarkerType background: string } 我的预期结
export interface LineItem {
category: string
values: number
marker: Marker
}
export interface Marker {
size: number
type: MarkerType
background: string
}
我的预期结果是得到一个折线图,其中每个数据点的大小、形状(圆形、十字形、三角形、正方形)和边框颜色都不同。因此,我想将“标记”的大小、类型和背景绑定到剑道图表系列项目标记-类型、大小和边框
找不到使用“dataItem”(类似于剑道工具提示的工作方式)获取单个数据点值的方法。我如何实现这一点
如果使用“SeriesMarkers”的“visual”是实现此功能的唯一方法,请提供示例代码帮助我。我已使用visual实现了此功能(稍后将发布代码)。但我相信必须有一个更简单的方法来实现这一点。
import { Component, OnInit, Input } from '@angular/core';
import { LineItem } from '../../../model/external-model';
import { MarkerType } from '@progress/kendo-angular-charts';
@Component({
selector: 'line-chart',
templateUrl: './line-chart.component.html',
styleUrls: ['./line-chart.component.scss']
})
export class LineChartComponent implements OnInit {
categories: string[];
values: number[];
@Input() public chartData:LineItem[] = [];
public markerType: MarkerType = "cross";
constructor() { }
ngOnInit() {
this.categories = this.chartData.map(x => x.category);
this.values = this.chartData.map(x => x.values);
}
}
export interface LineItem {
category: string
values: number
marker: Marker
}
export interface Marker {
size: number
type: MarkerType
background: string
}