AnyChart 中的热图未显示所有 Y 值
Heatmap in AnyChart not showing all Y values
我正在尝试使用 AnyChart 在 Django 模板中显示热图,但当热图中并未显示所有 Y 值时,我遇到了问题。
如您在屏幕截图中所见,6 个值中有 3 个缺失。
这是模板中的代码:
...
<span>Mapped Dimensions</span>
<div id="mapped_dimensions_chart"></div>
<script>
anychart.onDocumentReady(function () {
chart = anychart.heatMap({{ map_dimensions_data_anychart | safe }});
var customColorScale = anychart.scales.linearColor();
customColorScale.colors(["#CF7A78", "#E69645", "#69A231", "#4D7623"]);
chart.colorScale(customColorScale);
chart.container("mapped_dimensions_chart");
chart.draw();
});
</script>
...
有人知道为什么会这样吗?
该图表倾向于避免 y 轴的标签重叠,因此隐藏了其中的一些标签。您可以禁用此行为并强制图表显示所有标签。为此,请将以下行添加到您的代码中:
chart.yAxis().overlapMode('allow-overlap');
我正在尝试使用 AnyChart 在 Django 模板中显示热图,但当热图中并未显示所有 Y 值时,我遇到了问题。
如您在屏幕截图中所见,6 个值中有 3 个缺失。
这是模板中的代码:
...
<span>Mapped Dimensions</span>
<div id="mapped_dimensions_chart"></div>
<script>
anychart.onDocumentReady(function () {
chart = anychart.heatMap({{ map_dimensions_data_anychart | safe }});
var customColorScale = anychart.scales.linearColor();
customColorScale.colors(["#CF7A78", "#E69645", "#69A231", "#4D7623"]);
chart.colorScale(customColorScale);
chart.container("mapped_dimensions_chart");
chart.draw();
});
</script>
...
有人知道为什么会这样吗?
该图表倾向于避免 y 轴的标签重叠,因此隐藏了其中的一些标签。您可以禁用此行为并强制图表显示所有标签。为此,请将以下行添加到您的代码中:
chart.yAxis().overlapMode('allow-overlap');