mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-14 20:00:09 +00:00
修复Legend的Background区域在Horizonal模式下不对的问题
This commit is contained in:
@@ -81,6 +81,7 @@ slug: /changelog
|
|||||||
|
|
||||||
## master
|
## master
|
||||||
|
|
||||||
|
* (2026.03.29) 修复`Legend`的`Background`区域在`Horizonal`模式下不对的问题
|
||||||
* (2026.03.25) 增加`Chart`的`Json`导出导入
|
* (2026.03.25) 增加`Chart`的`Json`导出导入
|
||||||
* (2026.03.10) 增加`Sankey`的线条tooltip触发显示
|
* (2026.03.10) 增加`Sankey`的线条tooltip触发显示
|
||||||
* (2026.03.10) 增加`UITable`的排序功能支持
|
* (2026.03.10) 增加`UITable`的排序功能支持
|
||||||
|
|||||||
@@ -198,11 +198,14 @@ namespace XCharts.Runtime
|
|||||||
legend.context.eachHeight = 0;
|
legend.context.eachHeight = 0;
|
||||||
if (legend.orient == Orient.Horizonal)
|
if (legend.orient == Orient.Horizonal)
|
||||||
{
|
{
|
||||||
|
var maxRowWidth = 0f;
|
||||||
foreach (var kv in legend.context.buttonList)
|
foreach (var kv in legend.context.buttonList)
|
||||||
{
|
{
|
||||||
if (width + kv.Value.width > maxWidth)
|
if (width + kv.Value.width > maxWidth)
|
||||||
{
|
{
|
||||||
realWidth = width - legend.itemGap;
|
realWidth = width - legend.itemGap;
|
||||||
|
if (realWidth > maxRowWidth)
|
||||||
|
maxRowWidth = realWidth;
|
||||||
realHeight += height + legend.itemGap;
|
realHeight += height + legend.itemGap;
|
||||||
if (legend.context.eachHeight < height + legend.itemGap)
|
if (legend.context.eachHeight < height + legend.itemGap)
|
||||||
{
|
{
|
||||||
@@ -216,8 +219,10 @@ namespace XCharts.Runtime
|
|||||||
height = kv.Value.height;
|
height = kv.Value.height;
|
||||||
}
|
}
|
||||||
width -= legend.itemGap;
|
width -= legend.itemGap;
|
||||||
|
if (width > maxRowWidth)
|
||||||
|
maxRowWidth = width;
|
||||||
legend.context.height = realHeight + height;
|
legend.context.height = realHeight + height;
|
||||||
legend.context.width = realWidth > 0 ? realWidth : width;
|
legend.context.width = maxRowWidth;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user