How to display scales at several points on the x-axis of an area chart?
Question Description
Area charts like (https://www.visactor.io/vchart/demo/area-chart/null-value-area) contain a lot of data, such as hundreds. When the label content on some axes is too long, it is easy to overlap or be too visually dense. The scales on the X-axis need to be displayed at certain intervals.
Is there any configuration for this type of chart so that the coordinate axis displays scales every few points, similar to echarts' interval?
Solution
Different chart libraries have different solutions. According to the demo you gave, you only need to enable axis sampling in VChart to avoid the problem of axis text occlusion.
- sampling Whether to enable axis data sampling, enabled by default. After axis sampling is turned on, axis data will be sampled and displayed to prevent overlapping of axis data.
If you also want to customize the spacing between axis labels, you can control the spacing between axis labels by configuring label.minGap.
- MinGap can be used to customize the minimum spacing between labels (unit: pixels). Only takes effect when axis sampling starts (sampling: true). This configuration affects the results of axis sampling.