Hi Jake_Raz.
Thank you for your question. I haven't been able to test this script due to issues with my test environment, but give this a try,
javascript
widget.on('processresult', function(se, ev) {
var options = ev.result.seriesDefaults.labels;
options.template = "#= category #: #= value #";
options.distance = -30; // Adjusts how close the labels are to the edges of the pie slices
options.color = "#fff"; // Optional: changes labels color, modify as needed
// Disable connectors (leader lines)
options.connectors = {
width: 0,
color: "transparent"
};
});
**Explanation:**
- processresult
: This function is called after the data is processed but before it is rendered. It's the right place to make changes to the chart’s configuration.
- labels.template
: This controls what is displayed in the labels. Here, it shows both the category and value. You can customize it to your needs.
- labels.distance
: This moves the label closer or farther from the center. You should adjust this value based on your label size and chart dimensions.
- labels.connectors.width
: Setting this to 0
effectively hides the leader lines.
- labels.connectors.color
: Setting color to "transparent" further ensures that the lines are not visible.
- labels.color
: This is optional, allowing you to set the color of the text, which can be handy depending on your chart's background.
This script will hide the leader lines effectively while retaining the labels. Customize the parameters further according to your specific visual design preferences. Should you have more complex visualization needs or run into any issues, don’t hesitate to reach out.