スケールのWPF棒グラフ手動
質問
私は、コンピュータをスキャンしていますし、その規模は、彼らが1,2,3,4のような整数である必要があり1.5,2,2.5ようにすることはできません。
私の現在のコードがある
ICollection<KeyValuePair<String, int>> data = new Dictionary<String, int>();
data.Add(new KeyValuePair<string, int>(Protocol, protocolCount));
mycolseries = new ColumnSeries
{
ItemsSource = data,
Title = Protocol,
IndependentValuePath = "Key",
DependentValuePath = "Value",
};
mainChart.Series.Add(mycolseries);
私は「キー」に依存した値を変更する場合は、は、それが「呼び出しまたは要素に使用する必要があり、新たな、または初期化されていません」のような奇妙なエラーが発生します。
解決
public void Window1(){
setChartSCale()
}
private void setChartScale()
{
lamainChart.Interval = 1;
lamainChart.Orientation = AxisOrientation.Y;
lamainChart.ShowGridLines = true;
//lamainChart.Maximum = 50;
lamainChart.Minimum = 0;
}
recursivlyこのメソッドを呼び出します。
private void addRecursiveLedgendAfterInit(string Protocol, int protocolCount)
{
ICollection<KeyValuePair<String, int>> data = new Dictionary<String, int>();
data.Add(new KeyValuePair<string, int>(Protocol, protocolCount));
mycolseries = new ColumnSeries
{
ItemsSource = data,
Title = Protocol,
IndependentValuePath = "Key",
DependentRangeAxis =lamainChart,
DependentValuePath = "Value"
};
mainChart.Series.Add(mycolseries);
}
所属していません StackOverflow