Telerik Donut Chart - Custom Label

I want to adjust the position of the Telerik Donut Chart label, and it should look like the expected image. I tried a couple of settings, but could not adjust the position of the label, see Image poc.

Questions - How to change the position of the mark so that it looks like the expected image. I want 5,10,15,20,25, ... outside the second ring and label should be the end of each category.

Expected

enter image description here

POC

enter image description here

the code

$("#chart").kendoChart({
  legend: {
    visible: false
  },
  chartArea: {
    background: ""
  },
  seriesDefaults: {
    type: "donut",
    startAngle: 90,
    labels:{
      template: "#= category #",
    }
  },
  series: [{
    name: "abc",
    size:50,
    margin:2,
    data: [{
      category: "abc1",
      value: 50,
      color: "#7FBA00"
    },{
      category: "abc2",
      value: 20,
      color: "#007233"
    },{
      category: "abc3",
      value: 30,
      color: "#D2D2D2"
    }]
  }, {
    name: "xyz",
    size:10,
    data: [{
      category: "5",
      value: 10,
      color: "#ccc"
    },{
      category: "10",
      value: 10,
      color: "#AFAFAF"
    },{
      category: "15",
      value: 10,
      color: "#ccc"
    },{
      category: "20",
      value: 10,
      color: "#AFAFAF"
    },{
      category: "25",
      value: 10,
      color: "#ccc"
    },{
      category: "30",
      value: 10,
      color: "#AFAFAF"
    }],
    labels: {
      visible: true,
      background: "transparent",
      position: "center"
    }
  }]
});
+4
source share
1 answer

, , , Telerik, . , , , ( ) , .

enter image description here

$("#chart").kendoChart({
  legend: {
    visible: false
  },
  chartArea: {
    background: ""
  },
  seriesDefaults: {
    type: "donut",
    startAngle: 90,
    labels:{
      template: "#= category #",
    }
  },
  series: [{
    name: "yourData",
    size:50,
    margin:2,
    data: [{
      category: "abc1",
      value: 50,
      color: "#7FBA00"
    },{
      category: "abc2",
      value: 20,
      color: "#007233"
    },{
      category: "abc3",
      value: 30,
      color: "#D2D2D2"
    }]
  }, {
    name: "grayAxis",
    size:10,
    data: [{
      value: 10,
      color: "#ccc"
    },{
      value: 10,
      color: "#AFAFAF"
    },{
      value: 10,
      color: "#ccc"
    },{
      value: 10,
      color: "#AFAFAF"
    },{
      value: 10,
      color: "#ccc"
    },{
      value: 10,
      color: "#AFAFAF"
    }]
  } , {
    name: "numbers",
    size:10,
    data: [{
      category: "",
      value: 9,
      color: "none"
    },{
      category: "5",
      value: 1,
      color: "none"
    },{
      category: "",
      value: 9,
      color: "none"
    },{
      category: "10",
      value: 1,
      color: "none"
    },{
      category: "",
      value: 9,
      color: "none"
    },{
      category: "15",
      value: 1,
      color: "none"
    },{
      category: "",
      value: 9,
      color: "none"
    },{
      category: "20",
      value: 1,
      color: "none"
    },{
      category: "",
      value: 9,
      color: "none"
    },{
      category: "25",
      value: 1,
      color: "none"
    },{
      category: "",
      value: 9,
      color: "none"
    },{
      category: "X",
      value: 1,
      color: "none"
    }],
    labels: {
      visible: true,
      background: "transparent",
      template: "#= category #",
      position: "center"
    } 
  }]
});

, , "X" "", , , , 90 , , 89,5 , 9 + 1, , -- .. ..

, , : , , .

, ?

+4

Source: https://habr.com/ru/post/1570518/


All Articles