Fixed the problem of displaying exceptions after adding data again when DataZoom is enable (#163)

This commit is contained in:
monitor1394
2021-08-16 14:47:02 +08:00
parent 3590d1ebbc
commit d87e0f8267
4 changed files with 21 additions and 3 deletions

View File

@@ -39,6 +39,7 @@
## master
* (2021.08.15) Fixed the problem of displaying exceptions after adding data again when `DataZoom` is enable (#163)
* (2021.08.15) Improved `Axis`'s `AxisLabel` text rotate setting to avoid inconsistency offset in `DataZoom` (#163)
* (2021.08.14) Added `Legend`'s `textAutoColor` to set the text color match with `Serie` color (#163)
* (2021.08.12) Optimize `BarChart` setting `Corner` when the positive and negative columns are fillet symmetric

View File

@@ -39,6 +39,7 @@
## master
* (2021.08.15) 修复`DataZoom`开启时重新添加数据后图表数据显示异常的问题 (#163)
* (2021.08.15) 优化`Axis``AxisLabel`文本旋转设置避免在DataZoom开启时偏移不一致 (#163)
* (2021.08.14) 增加`Legend``textAutoColor`设置文本颜色和`Serie`一致 (#163)
* (2021.08.12) 优化`BarChart`设置`Corner`时正负柱条圆角对称

View File

@@ -36,9 +36,22 @@ namespace XCharts.Examples
void OnTestBtn()
{
int index = Random.Range(0, chart.series.Count);
var serie = chart.series.GetSerie(index);
chart.UpdateData(index, Random.Range(0, serie.dataCount), Random.Range(50, 100));
object[][] m_TestData = new object[][]{
new object[]{"01/06/20", 2.2d, 5.6d},
new object[]{"22/06/20", 2.4d, 5.3d},
new object[]{"04/08/21", 4.5d, 5.4d},
new object[]{"05/08/21", 6.3d, 6.4d},
new object[]{"06/08/21", 3.1d, 6.4d},
new object[]{"09/08/21", 3.9d, 6.3d},
new object[]{"10/08/21", 1.9d, 4.6d},
};
chart.ClearData();
foreach (var list in m_TestData)
{
chart.AddXAxisData((string)list[0]);
chart.AddData(0, (double)list[1]);
chart.AddData(1, (double)list[2]);
}
}
void AddData()

View File

@@ -1355,6 +1355,7 @@ namespace XCharts
RemoveData(0);
}
m_Data.Clear();
m_NeedUpdateFilterData = true;
SetVerticesDirty();
}
@@ -1388,6 +1389,7 @@ namespace XCharts
m_DownSmoothPoints.Remove(serieData.index);
}
m_Data.RemoveAt(index);
m_NeedUpdateFilterData = true;
}
}
@@ -1416,6 +1418,7 @@ namespace XCharts
{
if (m_InsertDataToHead) m_Data.Insert(0, serieData);
else m_Data.Add(serieData);
m_NeedUpdateFilterData = true;
}
private void CheckDataName(string dataName)