mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-14 20:00:09 +00:00
增加Bar支持通过VisualMap设置颜色
This commit is contained in:
@@ -80,7 +80,8 @@ slug: /changelog
|
||||
|
||||
## master
|
||||
|
||||
* (2025.04.15) 增加`AxisLabel`的`showZeroLabel`设置是否显示0刻度
|
||||
* (2025.04.15) 增加`Bar`支持通过`VisualMap`设置颜色
|
||||
* (2025.04.14) 增加`AxisLabel`的`showZeroLabel`设置是否显示0刻度
|
||||
* (2025.04.08) 增加`UIStatistic`的`desc`描述文本设置支持
|
||||
* (2025.04.07) 修复`Gantt`甘特图在有多维数据时计算的时间区间不准确的问题
|
||||
* (2025.04.07) 优化`Axis`的`Time`时间轴支持设置Custom和ceilRate
|
||||
|
||||
@@ -180,7 +180,7 @@ namespace XCharts.Runtime
|
||||
|
||||
if (showData.Count <= 0)
|
||||
return;
|
||||
|
||||
var visualMap = chart.GetVisualMapOfSerie(serie);
|
||||
var axisLength = isY ? m_SerieGrid.context.height : m_SerieGrid.context.width;
|
||||
var relativedAxisLength = isY ? m_SerieGrid.context.width : m_SerieGrid.context.height;
|
||||
var axisXY = isY ? m_SerieGrid.context.y : m_SerieGrid.context.x;
|
||||
@@ -218,6 +218,13 @@ namespace XCharts.Runtime
|
||||
serie.containerIndex = m_SerieGrid.index;
|
||||
serie.containterInstanceId = m_SerieGrid.instanceId;
|
||||
serie.animation.InitProgress(axisXY, axisXY + axisLength);
|
||||
var visualMapDimension = VisualMapHelper.GetDimension(visualMap, defaultDimension);
|
||||
if (visualMap != null && visualMap.show && visualMap.autoMinMax)
|
||||
{
|
||||
double maxValue, minValue;
|
||||
SerieHelper.GetMinMaxData(serie, visualMapDimension, out minValue, out maxValue);
|
||||
VisualMapHelper.SetMinMax(visualMap, minValue, maxValue);
|
||||
}
|
||||
for (int i = serie.minShow; i < maxCount; i++)
|
||||
{
|
||||
var serieData = showData[i];
|
||||
@@ -244,6 +251,12 @@ namespace XCharts.Runtime
|
||||
if (!serieData.interact.TryGetColor(ref areaColor, ref areaToColor, ref interacting, interactDuration))
|
||||
{
|
||||
SerieHelper.GetItemColor(out areaColor, out areaToColor, serie, serieData, chart.theme);
|
||||
if (visualMap != null && visualMap.show)
|
||||
{
|
||||
var visualValue = serieData.GetData(visualMapDimension, relativedAxis.inverse);
|
||||
areaColor = visualMap.GetColor(visualValue);
|
||||
areaToColor = areaColor;
|
||||
}
|
||||
serieData.interact.SetColor(ref interacting, areaColor, areaToColor);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user