2

こんにちはX軸とY軸のラベルを設定するにはどうすればよいですか?

さて、値を含むグラフがあり、ツールチップをフォーマットしましたが、X軸とY軸のラベルを設定する方法がわかりません。

もう1つは、チャートシリーズでズームを実行することは可能ですか。つまり、x軸が年単位の場合、月単位に変更したいのですが、学期と新しいポイントを線に表示する必要がありますか?これが可能であるならば、それをするのは難しすぎますか?

4

1 に答える 1

1

y 軸のラベルを設定することはできません (可能ではないと思います) が、Title プロパティを使用して凡例に設定することはできます。x 軸では、DataPointSeries'IndependentValueBinding に設定されたバインディングによって異なります。

このサンプルで、すべてのレコード/データポイントを表すクラス オブジェクトを作成したとしましょう。

public class ChartInfo
{
    public string Label { get; set; }
    public double Value { get; set; }
}

それから私はこのコードを持っています:

List<ChartInfo> list = new List<ChartInfo>();
ChartInfo item = new ChartInfo();
item.Label = "Individual";
item.Vale = 27;
list.Add(item);
item = new ChartInfo();
item.Label = "Corporate";
item.Vale = 108;
list.Add(item);

DataPointSeries series = new ColumnSeries();
series.Title = "Quantity";
series.DependentValueBinding = new Binding("Value");
series.IndependentValueBinding = new Binding("Label");
series.ItemsSource = list;
series.SelectionChanged += new SelectionChangedEventHandler(series_SelectionChanged);
this.chartingToolkitControl.Series.Add(series);

それは私にこの結果を与えるでしょう。

代替テキスト http://www.freeimagehosting.net/uploads/78e2598620.jpg

ズーミングについては、適切な用語はドリルダウンだと思います。SelectionChanged イベントを使用できます (上記のコードを参照)。すべきことは、データソースを再クエリし、グラフのシリーズをクリアして、クエリ結果に基づいて新しいシリーズを追加することです。

private void series_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        //The sender here is of type DataPointSeries wherein you could get the SelectedItem (in our case ChartInfo) and from there you could do the requery.
    }
于 2010-03-03T01:29:51.963 に答える