mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-25 18:30:14 +00:00
[fix] fix InsertSerie()
This commit is contained in:
@@ -51,15 +51,9 @@ namespace XCharts.Example
|
|||||||
|
|
||||||
void AddData()
|
void AddData()
|
||||||
{
|
{
|
||||||
chart.ClearData();
|
var serie = chart.InsertSerie<Bar>(0);
|
||||||
int count = Random.Range(5, 100);
|
for(int i=0;i<5;i++){
|
||||||
for (int i = 0; i < count; i++)
|
chart.AddData(serie.index, Random.Range(10,90));
|
||||||
{
|
|
||||||
chart.AddXAxisData("x" + i);
|
|
||||||
if (Random.Range(1, 3) == 2)
|
|
||||||
chart.AddData(0, Random.Range(-110, 200));
|
|
||||||
else
|
|
||||||
chart.AddData(0, Random.Range(-100, 100));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,9 @@ namespace XCharts.Runtime
|
|||||||
public T InsertSerie<T>(int index, string serieName = null, bool show = true) where T : Serie
|
public T InsertSerie<T>(int index, string serieName = null, bool show = true) where T : Serie
|
||||||
{
|
{
|
||||||
if (!CanAddSerie<T>()) return null;
|
if (!CanAddSerie<T>()) return null;
|
||||||
return InsertSerie(index, typeof(T), serieName, show) as T;
|
var serie = InsertSerie(index, typeof(T), serieName, show) as T;
|
||||||
|
InitSerieHandlers();
|
||||||
|
return serie;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InsertSerie(Serie serie, int index = -1, bool addToHead = false)
|
public void InsertSerie(Serie serie, int index = -1, bool addToHead = false)
|
||||||
@@ -30,9 +32,7 @@ namespace XCharts.Runtime
|
|||||||
else if (index >= 0) m_Series.Insert(index, serie);
|
else if (index >= 0) m_Series.Insert(index, serie);
|
||||||
else m_Series.Add(serie);
|
else m_Series.Add(serie);
|
||||||
ResetSeriesIndex();
|
ResetSeriesIndex();
|
||||||
InitSerieHandlers();
|
|
||||||
SeriesHelper.UpdateSerieNameList(this, ref m_LegendRealShowName);
|
SeriesHelper.UpdateSerieNameList(this, ref m_LegendRealShowName);
|
||||||
RefreshChart();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool MoveUpSerie(int serieIndex)
|
public bool MoveUpSerie(int serieIndex)
|
||||||
|
|||||||
Reference in New Issue
Block a user