Сейчас я использую Telerik UI для WPF RadCartesianChart's LineSeries для отображения всплывающей подсказки. Но при загрузке огромного количества данных о 18866 записях пользовательский интерфейс становится слишком медленным, чтобы показывать всплывающие подсказки, и, наконец, останавливается. Может ли кто-нибудь помочь мне, как решить эту проблему? Большое спасибо.
Это View / TabView.xaml
<telerik:RadCartesianChart x:Name="RotGraph"
MinHeight="325"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
Panel.ZIndex="5"
MouseDown="RotGraph_MouseDown"
TouchDown="RotGraph_TouchDown">
<telerik:RadCartesianChart.Behaviors>
<telerik:ChartTooltipBehavior HorizontalOffset="-11" VerticalOffset="-50"/>
</telerik:RadCartesianChart.Behaviors>
<telerik:RadCartesianChart.TooltipTemplate>
<DataTemplate>
<Grid>
<Border Background="White" BorderBrush="black" BorderThickness="1" Padding="5" CornerRadius="3">
<StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=DataItem.LegendName}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=DataItem.ToolTipDate}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=DataItem.ToolTipValue}"/>
</StackPanel>
</StackPanel>
</Border>
</Grid>
</DataTemplate>
</telerik:RadCartesianChart.TooltipTemplate>
<telerik:RadCartesianChart.HorizontalAxis>
<telerik:DateTimeCategoricalAxis HorizontalContentAlignment="Stretch"
LabelFormat="MMMdd"
LabelInterval="1"
LabelStyle="{DynamicResource LabelStyle}"
LastLabelVisibility="Visible"
LineStroke="{DynamicResource CouleurTexte}"
LineThickness="1"
utilities:ChartUtilities.MajorTickInterval= "{Binding Tab.MajorTickInterval}"
LabelFitMode="Rotate"
MajorTickLength="5"
MajorTickOffset="0"
PlotMode="OnTicks"
SmartLabelsMode="SmartStep"
TickThickness="3"
ZIndex="0" />
</telerik:RadCartesianChart.HorizontalAxis>
<telerik:RadCartesianChart.VerticalAxis>
<telerik:LinearAxis Title="(tons/day)"
LabelInterval="1"
LabelStyle="{StaticResource LabelStyle}"
LineStroke="{DynamicResource CouleurTexte}"
LineThickness="1"
MajorStep="1"
SmartLabelsMode="SmartStep"
TickThickness="1" />
</telerik:RadCartesianChart.VerticalAxis>
<telerik:RadCartesianChart.Resources>
<telerik:LinearAxis x:Key="AxisR"
Title="(deg)"
HorizontalLocation="Right"
LabelInterval="1"
LabelStyle="{DynamicResource LabelStyle}"
LineStroke="#FFCE8819"
SmartLabelsMode="SmartStep" />
</telerik:RadCartesianChart.Resources>
<telerik:LineSeries x:Name="rollstt"
CategoryBinding="TimeStampX"
ItemsSource="{Binding Tab.RollGraph}"
Stroke="White"
ValueBinding="ValueY"
VerticalAxis="{StaticResource AxisR}"
Visibility="{Binding Tab.IsRollSelected, Converter={StaticResource BooleanToVisibilityConverter}}">
<telerik:LineSeries.LegendSettings>
<telerik:SeriesLegendSettings Title="Roll (deg)" />
</telerik:LineSeries.LegendSettings>
<telerik:LineSeries.DefaultVisualStyle>
<Style TargetType="Path">
<Setter Property="Width" Value="4" />
<Setter Property="Height" Value="4" />
<Setter Property="Fill" Value="White" />
</Style>
</telerik:LineSeries.DefaultVisualStyle>
</telerik:LineSeries>
<telerik:LineSeries x:Name="pitchstt"
CategoryBinding="TimeStampX"
ItemsSource="{Binding Tab.PitchGraph}"
Stroke="#FFF19400"
ValueBinding="ValueY"
VerticalAxis="{StaticResource AxisR}"
Visibility="{Binding Tab.IsPitchSelected, Converter={StaticResource BooleanToVisibilityConverter}}">
<telerik:LineSeries.LegendSettings>
<telerik:SeriesLegendSettings Title="Pitch (deg)" />
</telerik:LineSeries.LegendSettings>
<telerik:LineSeries.DefaultVisualStyle>
<Style TargetType="Path">
<Setter Property="Width" Value="4" />
<Setter Property="Height" Value="4" />
<Setter Property="Fill" Value="#FFF19400" />
</Style>
</telerik:LineSeries.DefaultVisualStyle>
</telerik:LineSeries>
<telerik:LineSeries x:Name="natbog1"
CategoryBinding="TimeStampX"
ItemsSource="{Binding Tab.NBOGStats}"
Stroke="#FF08A1EE"
ValueBinding="ValueY">
<telerik:LineSeries.LegendSettings>
<telerik:SeriesLegendSettings Title="Natural Bog (tons/day)" />
</telerik:LineSeries.LegendSettings>
<telerik:LineSeries.DefaultVisualStyle>
<Style TargetType="Path">
<Setter Property="Width" Value="4" />
<Setter Property="Height" Value="4" />
<Setter Property="Fill" Value="#FF08A1EE" />
</Style>
</telerik:LineSeries.DefaultVisualStyle>
</telerik:LineSeries>
</telerik:RadCartesianChart>
Это модель / ShipMotionStat.cs
public void SetValueGraphDatafromSQL(DateTime StartDate, DateTime EndDate)
{
try
{
var pitch = new ObservableCollection<ChartData>();
var roll = new ObservableCollection<ChartData>();
var sway = new ObservableCollection<ChartData>();
var surge = new ObservableCollection<ChartData>();
var heave = new ObservableCollection<ChartData>();
var yaw = new ObservableCollection<ChartData>();
//gets all the current values in a collection where each timestamp has corresponding values
IEnumerable<ExchangeFile.TimeValue> stats = AllDBdatas.Where(a => a.TimeStamp >= StartDate && a.TimeStamp <= EndDate).OrderBy(c => c.TimeStamp);
//Create graph values for motion Stat
foreach (ExchangeFile.TimeValue item in stats)
{
try
{
//Data creation for pitch graphs
pitch.Add(new ChartData()
{
TimeStampX = item.TimeStamp,
ValueY = item.Value[PitchPostion],
LegendName = "Pitch",
ToolTipDate = item.TimeStamp.ToString(),
ToolTipValue = item.Value[PitchPostion].ToString("F") + " deg"
});
//Data creation for roll graphs
roll.Add(new ChartData()
{
TimeStampX = item.TimeStamp,
ValueY = item.Value[RollPosition],
LegendName = "Roll",
ToolTipDate = item.TimeStamp.ToString(),
ToolTipValue = item.Value[RollPosition].ToString("F") + " deg"
});
sway.Add(new ChartData()
{
TimeStampX = item.TimeStamp,
ValueY = item.Value[SwayPosition],
LegendName = "Sway",
ToolTipDate = item.TimeStamp.ToString(),
ToolTipValue = item.Value[SwayPosition].ToString("F") + " m"
});
surge.Add(new ChartData()
{
TimeStampX = item.TimeStamp,
ValueY = item.Value[SurgePosition],
LegendName = "Surge",
ToolTipDate = item.TimeStamp.ToString(),
ToolTipValue = item.Value[SurgePosition].ToString("F") + " m"
});
heave.Add(new ChartData()
{
TimeStampX = item.TimeStamp,
ValueY = item.Value[HeavePostion],
LegendName = "Heave",
ToolTipDate = item.TimeStamp.ToString(),
ToolTipValue = item.Value[HeavePostion].ToString("F") + " m"
});
yaw.Add(new ChartData()
{
TimeStampX = item.TimeStamp,
ValueY = item.Value[YawPosition],
LegendName = "Yaw",
ToolTipDate = item.TimeStamp.ToString(),
ToolTipValue = item.Value[YawPosition].ToString("F") + " m"
});
}
catch (Exception e)
{
statLog.AddLog(e);
//Continue loop even exception occured, Sometimes the Dataset will have issue based on the latency of the Server
continue;
}
}
if (NatboTotal != null)
{
NaturalBOG = new ObservableCollection<ChartData>(NatboTotal.Where(a => a.TimeStampX >= StartDate && a.TimeStampX <= EndDate));
}
else
{
NaturalBOG = new ObservableCollection<ChartData>();
}
RollGraph = roll;
PitchGraph = pitch;
HeaveGraph = heave;
SurgeGraph = surge;
SwayGraph = sway;
YawGraph = yaw;
//Inform the main model that Graph data are updated
Messenger.Default.Send<NotificationMessage>(new NotificationMessage("MotionsStatsUpdated"));
}
catch (Exception e)
{
statLog.AddLog(e);
}
}