如何使用圆圈图标制作剑道图表图例?

时间:2018-06-07 11:04:00

标签: javascript kendo-ui telerik kendo-chart

我看到其他答案,但它是三角形的。我真正需要的是做一个如下图所示的圆形图标:

Legend with circle icons

我尝试通过Dojo example在此Circle Geometry API中自定义“kendo.geometry.Rect”。但我需要帮助理解我应该做的事情。

1 个答案:

答案 0 :(得分:2)

You 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;
}