How to customize the shape and text style of the legend?
Problem Description
Please tell me how to customize the shape of the legend item and modify the style of the text to achieve a legend style similar to the following figure:
Solution
Different chart library solutions have different solutions. The following is an introduction to how to configure using VChart. Currently, to achieve the display effect of the above figure with VChart, you need:
- Customize data, mainly to add a numerical field to the legend item data, so that the numerical value can be displayed on the legend item, and the style of the numerical value can also be configured through the
item.value
attribute - In VChart, the pie chart legend shape is circular by default, but if you want to configure it into other shapes, you can configure it directly through
item.shape.style.symbolType
Code Example
Related Documentation Related Documentation
- Legend tutorial: https://www.visactor.io/vchart/guide/tutorial_docs/Chart_Concepts/Legend
- Legend configuration: https://www.visactor.io/vchart/option/lineChart#legends-discrete.type