0

wpf toolkit chart を使用して、ポイントの大規模なコレクション (少なくとも 300 000 ポイント) をチャートとして表示したいと考えています。

次のXAMLがあります

<chartingToolkit:Chart Name="chartHistory">
    <chartingToolkit:Chart.Axes>
        <chartingToolkit:LinearAxis x:Name="horizontalAxis" Orientation="X" Title="Time [s]"  ShowGridLines="True"/>
        <chartingToolkit:LinearAxis x:Name="verticalAxis" Orientation="Y" Title="Value [mm]"  ShowGridLines="True"/>
    </chartingToolkit:Chart.Axes>
    <chartingToolkit:AreaSeries x:Name="chartSeries" DataPointStyle="{StaticResource chartDataPoint}"
        IndependentValuePath="TimeInSeconds"
        DependentValuePath="Value">
    </chartingToolkit:AreaSeries>
</chartingToolkit:Chart>

そしてコードビハインドで:

public class PointData
{
    public double TimeInSeconds { get; set; }
    public double Value { get; set; }
}

private List<PointData> points;

private void Screen_Loaded(object sender, RoutedEventArgs e)
{
    // this is a large collection of points (minimum 300 000)
    points = LoadPointsFromFile();

    // and it takes a lot of time to read from the file and load in the UI
    chartSeries.ItemsSource = points;

    // additional chart display properties (setting min/max on the axes etc.)
}

そのため、UI をブロックする 2 つの時間のかかる操作があります。私が望むのは、時間のかかる操作が行われている間に「ダイアログをロードしてください」を表示して、アプリケーションがまだ何かを実行していることをユーザーに知らせることです。

時間のかかる操作は次のとおりです。

  1. ファイルからポイントを読み取る (この操作は別のスレッドで実行できますが、次の操作 (チャートにポイントをロードする) はそれに依存し、UI 操作であるため、別のスレッドには入れませんでした)
  2. ポイントを ItemsSource としてチャートにロードします。これは UI 操作であり、UI スレッドで実行する必要があります。しかし、ポイントがどのように表示されるかを制御できないので、どうすればアプリケーションをレスポンシブにできますか? これはチャート独自のロジックです。

それで、何かアイデアはありますか?同様の問題はありましたか?ありがとう、ナディア

4

1 に答える 1