如何用圆圈图标制作 Kendo 图表图例?
How to make Kendo chart legend with circle icon?
我看到了其他答案,但它是三角形的。我真正需要的是像下图那样做一个圆圈图标:
我尝试在 Dojo example by the Circle Geometry API 中自定义 "kendo.geometry.Rect"。但是我需要帮助来理解我应该做什么。
您的 Circle Geometry 仅定义中心和半径。然后你需要使用 drawing.Circle:
visual: function (e) {
// get color of current marker and label
var color = e.options.markers.background;
var labelColor = e.options.labels.color;
var rect = new kendo.geometry.Rect([0, 0], [100, 50]);
var layout = new kendo.drawing.Layout(rect, {
spacing: 5,
alignItems: "center"
});
// create a circle geometry centered at x=10, y=5, with a radius of 5
var CircGeometry = new kendo.geometry.Circle([10, 5], 5);
// draw the circle using the geometry and set the color (could have no stroke)
var MarkerCircle = new kendo.drawing.Circle(CircGeometry, {
stroke: { color: color, width: 1 },
fill: { color: color }
});
//Create the text label
var label = new kendo.drawing.Text(e.series.name, [0, 0], {
fill: {
color: labelColor
}
});
//Add circle and label to layout object
layout.append(MarkerCircle, label);
layout.reflow()
return layout;
}
我看到了其他答案,但它是三角形的。我真正需要的是像下图那样做一个圆圈图标:
我尝试在 Dojo example by the Circle Geometry API 中自定义 "kendo.geometry.Rect"。但是我需要帮助来理解我应该做什么。
您的 Circle Geometry 仅定义中心和半径。然后你需要使用 drawing.Circle:
visual: function (e) {
// get color of current marker and label
var color = e.options.markers.background;
var labelColor = e.options.labels.color;
var rect = new kendo.geometry.Rect([0, 0], [100, 50]);
var layout = new kendo.drawing.Layout(rect, {
spacing: 5,
alignItems: "center"
});
// create a circle geometry centered at x=10, y=5, with a radius of 5
var CircGeometry = new kendo.geometry.Circle([10, 5], 5);
// draw the circle using the geometry and set the color (could have no stroke)
var MarkerCircle = new kendo.drawing.Circle(CircGeometry, {
stroke: { color: color, width: 1 },
fill: { color: color }
});
//Create the text label
var label = new kendo.drawing.Text(e.series.name, [0, 0], {
fill: {
color: labelColor
}
});
//Add circle and label to layout object
layout.append(MarkerCircle, label);
layout.reflow()
return layout;
}