0
我試圖從代碼後面的圖表中某行的顏色設置。我已經搜索了3個小時怎麼做,我找不到任何東西。這有可能做到嗎?如果它不能做到,請推薦另一個圖表庫,我可以做到這一點。如何更改Windows Phone 8.1 XAML ToolKit圖表中LineSeries的顏色?
謝謝!
XAML
<Charting:Chart Title="Name" x:Name="LineChart" HorizontalAlignment="Left" VerticalAlignment="Center" Width="510" Height="450">
<Charting:LineSeries Title="PB" IndependentValuePath="Name" DependentValuePath="Amount" IsSelectionEnabled="True"/>
<Charting:LineSeries Title="Oil" IndependentValuePath="Name" DependentValuePath="Amount" IsSelectionEnabled="True"/>
</Charting:Chart>
WPF
Random rand = new Random();
List<FinancialStuff> financialStuffList = new List<FinancialStuff>();
for (int i = 0; i < 30; i++)
financialStuffList.Add(new FinancialStuff() { Name = Convert.ToString(i), Amount = rand.Next(0, 200) });
(LineChart.Series[0] as LineSeries).ItemsSource = financialStuffList;
for (int i = 0; i < 30; i++)
financialStuffList[i].Amount = rand.Next(0, 50);
(LineChart.Series[1] as LineSeries).ItemsSource = financialStuffList;
public class FinancialStuff
{
public string Name { get; set; }
public int Amount { get; set; }
}
奧拉魯米爾恰感謝! XAML不起作用我收到錯誤,如成員「DataPointStyle」無法識別或無法訪問。 第一個選項工作,但僅限於線上的點,它會改變點的顏色而不是線的顏色。你知道如何改變它嗎? – Icet