【问题标题】:How to make Kendo chart legend with circle icon?如何用圆形图标制作剑道图表图例?
【发布时间】:2018-06-07 11:04:00
【问题描述】:

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

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

【问题讨论】:

    标签: javascript kendo-ui telerik kendo-chart


    【解决方案1】:

    您的圆形几何仅定义中心和半径。然后你需要使用 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;
    }
    

    【讨论】:

    • 非常感谢,成功了!虽然如果您有时间将 cmets 添加到您的 sn-p 中,这对我理解将有很大帮助:)
    • @xawi,我添加了 cmets
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-25
    • 1970-01-01
    • 2023-03-08
    • 2012-07-10
    • 2016-08-02
    • 2019-06-22
    相关资源
    最近更新 更多