我想在我的應用程式中添加動態微圖表,但它不起作用。在從方法呼叫后,添加了一個值,它為我的圖表創建了一個全新的微圖表以具有新值,但更改在應用程式中不可見。所以舊的價值觀一直存在,沒有新的價值觀。謝謝你幫助我。
WeightList = new List<float>();
WeightList.Add(0);
WeightList.Add((float)74.3);
entries = new ChartEntry[30];
SyncArray();
private void SyncArray()
{
if (WeightList.Count != entries.Length)
{
entries = new ChartEntry[WeightList.Count];
}
for (int i = 0; i <= WeightList.Count - 1; i )
{
if (i == WeightList.Count - 1 || i == 0)
{
entries[i] = new ChartEntry(WeightList[i]) { Label = "" i, ValueLabel = "" WeightList[i] };
}
else
{
entries[i] = new ChartEntry(WeightList[i]) { Label = "" i };
}
}
chart = new LineChart() { Entries = entries, BackgroundColor = SKColors.Transparent };
Chart = chart;
}
public LineChart Chart
{
get => chart;
set => SetProperty(ref chart, value);
}
public float Weight
{
get => weight;
set
{
weight = value;
WeightList.Add(weight);
SyncArray();
}
}
uj5u.com熱心網友回復:
學分:@Jason 要改變什么:
private void SyncArray()
{
if (WeightList.Count != entries.Length)
{
entries = new ChartEntry[WeightList.Count];
}
for (int i = 0; i <= WeightList.Count - 1; i )
{
if (i == WeightList.Count - 1 || i == 0)
{
entries[i] = new ChartEntry(WeightList[i]) { Label = "" i, ValueLabel = "" WeightList[i] };
}
else
{
entries[i] = new ChartEntry(WeightList[i]) { Label = "" i };
}
}
Chart = new LineChart() { Entries = entries, BackgroundColor = SKColors.Transparent };
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/433186.html
上一篇:NFC標簽防止復制NTag21x
