Commit 2407200c authored by 潘栩锋's avatar 潘栩锋 🚴

1. 改进 称重FlowGraph DisableAnimations="True" 把动画关掉,快了很多很多

parent fc6c69f0
......@@ -150,7 +150,12 @@
</Grid>
<Grid Grid.Row="1" Margin="-4,0,0,0">
<lvc:CartesianChart Series="{Binding Series}" Hoverable="False" DataTooltip="{x:Null}" >
<!--DisableAnimations="True" 这个非常重要,把速度提升了很多倍!!!-->
<lvc:CartesianChart DisableAnimations="True" Hoverable="False" DataTooltip="{x:Null}" >
<lvc:CartesianChart.Series>
<lvc:LineSeries Values="{Binding Values}" LineSmoothness="1" StrokeThickness="3" Configuration="{Binding Mapper}"
Stroke="{Binding Stroke}" Fill="Transparent" PointGeometrySize="0"/>
</lvc:CartesianChart.Series>
<lvc:CartesianChart.Resources>
<Style x:Key="CleanSeparator" TargetType="lvc:Separator">
<Setter Property="IsEnabled" Value="False"></Setter>
......
......@@ -43,29 +43,8 @@ namespace FLY.Weight.UI.Client.UIModule
grid_modelview.DataContext = flowGraphModelView;
grid_bufferwindow.DataContext = flowGraphModelView.bufferWindow;
}
/// <summary>
/// 测试界面用
/// </summary>
public void Debug()
{
flowGraphModelView = new FlowGraphModelView();
flowGraphModelView.InitData_Debug();
grid_modelview.DataContext = flowGraphModelView;
//TODO 有问题
//itemsControl.ItemsSource = flowGraphModelView.Series;
//stackpanel_window.DataContext = flowGraphModelView.bufferWindow;
}
//private void ListBox_OnPreviewMouseDown(object sender, MouseButtonEventArgs e)
//{
// var item = ItemsControl.ContainerFromElement(ListBox, (DependencyObject)e.OriginalSource) as ListBoxItem;
// if (item == null) return;
// var series = (StackedAreaSeries)item.Content;
// if (series.Visibility == Visibility.Visible)
// series.Visibility = Visibility.Hidden;
// else
// series.Visibility = Visibility;
//}
private void button_info_Click(object sender, RoutedEventArgs e)
{
......@@ -159,10 +138,13 @@ namespace FLY.Weight.UI.Client.UIModule
public ChartValues<FlyData_Flow> Values { get; set; }
/// <summary>
/// 折径曲线 XY 定义
/// 曲线值转换器
/// </summary>
//public CartesianMapper<FlyData_Flow> Mapper_ { get; set; }
public CartesianMapper<FlyData_Flow> Mapper { get; set; }
/// <summary>
/// 曲线颜色
/// </summary>
public Brush Stroke { get; set; }
/// <summary>
/// X轴格式
......@@ -198,10 +180,6 @@ namespace FLY.Weight.UI.Client.UIModule
/// </summary>
public DateTime EndTime { get; set; }
/// <summary>
/// 曲线
/// </summary>
public SeriesCollection Series { get; set; } = new SeriesCollection();
public ObservableCollection<FlowGraphModelView_Item> Items { get; } = new ObservableCollection<FlowGraphModelView_Item>();
/// <summary>
......@@ -256,18 +234,8 @@ namespace FLY.Weight.UI.Client.UIModule
//根据 weightSystemClient.Item创建Series
LineSeries series = new LineSeries
{
Fill = new SolidColorBrush(Colors.Transparent),
Stroke = new SolidColorBrush(Colors.Black),
LineSmoothness = 2,
StrokeThickness = 3,
Configuration = ConfigurationAll,
PointGeometrySize = 0
};
series.SetBinding(LiveCharts.Wpf.Series.ValuesProperty, new Binding("Values") { Source = this });
Series.Add(series);
Stroke = new SolidColorBrush(Colors.Black);
Mapper = ConfigurationAll;
BindingSeries();
weightSystemClient.ResetItemsEvent += BindingSeries;
......@@ -505,83 +473,6 @@ namespace FLY.Weight.UI.Client.UIModule
}
}
public void InitData_Debug()
{
graphParams = SysParam.Current.GraphParams;
DateTime date = DateTime.Now;
Random r = new Random();
double noise = 2;
double[] flows = new double[] { 50, 300, 300, 280, 20 };
ObservableCollection<FlyData_Flow> Record = new ObservableCollection<FlyData_Flow>();
for (int i = 0; i < 1000; i++)
{
FlyData_Flow flyData_Flow = new FlyData_Flow();
flyData_Flow.Time = date.AddSeconds(1 * i);
flyData_Flow.Items = new FlyData_FlowItem[flows.Count()];
for (int j=0;j< flows.Count(); j++)
{
flyData_Flow.Items[j] = new FlyData_FlowItem()
{
Flow = (float)(flows[j] + r.NextDouble() * noise - noise / 2)
};
}
Record.Add(flyData_Flow);
}
if (Record.Count <= ValuesCap)
{
Values.Clear();
Values.AddRange(Record);
}
else
{
Values.Clear();
for (int i = 0; i < ValuesCap; i++)
{
int idx = i * Record.Count / ValuesCap;
Values.Add(Record[idx]);
}
}
if (Values.Count() > 0)
{
BeginTime = Values.First().Time;
EndTime = Values.Last().Time;
}
else
{
BeginTime = DateTime.MinValue;
EndTime = DateTime.MinValue;
}
for (int i = 0; i < flows.Count(); i++)
{
LineSeries series = new LineSeries();
series.Title = ((char)('A' + i)).ToString();
series.Fill = WeighterColorDB.GetSelf(series.Title);
series.SetBinding(LiveCharts.Wpf.Series.ValuesProperty, new Binding("Values") { Source = this });
series.Configuration = new GetMapperOfFlyData_Flow(i).GetCartesianMapper();
Series.Add(series);
}
graphParams.IsAxisYRangeAuto = true;
if (graphParams.IsAxisYRangeAuto)
{
MaxValue = double.NaN;
MinValue = double.NaN;
}
else
{
MaxValue = AxisYTarget + graphParams.AxisYRange;
MinValue = AxisYTarget - graphParams.AxisYRange;
}
UpdateAxisYTarget();
}
void UpdateAxisYTarget()
{
FObjBase.PollModule.Current.Poll_JustOnce(() =>
......@@ -638,9 +529,8 @@ namespace FLY.Weight.UI.Client.UIModule
{
i.Visibility = Visibility.Hidden;
}
LineSeries series = Series[0] as LineSeries;
series.Stroke = new SolidColorBrush(Colors.Black);
series.Configuration = ConfigurationAll;
Stroke = new SolidColorBrush(Colors.Black);
Mapper = ConfigurationAll;
UpdateAxisYTarget();
}
......@@ -657,10 +547,8 @@ namespace FLY.Weight.UI.Client.UIModule
i.Visibility = Visibility.Visible;
}
}
LineSeries series = Series[0] as LineSeries;
series.Stroke = item.Fill;
series.Configuration = new GetMapperOfFlyData_Flow(item.Index).GetCartesianMapper();
Stroke = item.Fill;
Mapper = new GetMapperOfFlyData_Flow(item.Index).GetCartesianMapper();
UpdateAxisYTarget();
}
......
$src_path = $PSScriptRoot+ "\graphcustom\graphcustom.xml"
$root_path = $PSScriptRoot + "\.."
$dest_path = $root_path + "\Project.FLY.Thick.Blowing\FLY.Thick.Blowing.UI.Fix.Client\bin\Debug\layout\graphcustom.xml"
$dest_path = $root_path + "\Project.FLY.Thick.Blowing\FLY.Thick.Blowing.UI.Fix.Client\bin\Debug\layout\graphcustom_all_weight3.xml"
cp $src_path $dest_path
......
<?xml version="1.0" encoding="utf-8"?>
<FLYLayout DynAreaWidth="250" IsDynAreaVisible="True" Left="0" Top="2" Width="1366" Height="768" WindowState="Maximized">
<Items>
<GraphTabItem Header="称 重" ColumnCount="1" RowCount="2">
<ColumnDefinitions>
<Boolean value="False" />
</ColumnDefinitions>
<RowDefinitions>
<Boolean value="False" />
<Boolean value="False" />
</RowDefinitions>
<Graphs>
<GraphComponent ID="60426628" Module="FLY.Weight.UI.Client.UIModule.UIModule_Main" Row="0" Column="0" RowSpan="1" ColumnSpan="1" />
<GraphComponent ID="25136147" Module="FLY.Weight.UI.Client.UIModule.UIModule_FlowGraph" Row="1" Column="0" RowSpan="1" ColumnSpan="1" />
</Graphs>
</GraphTabItem>
<GraphTabItem Header="风 环" ColumnCount="1" RowCount="4">
<ColumnDefinitions>
<Boolean value="False" />
......@@ -54,7 +67,8 @@
<Boolean value="False" />
</RowDefinitions>
<Graphs>
<GraphComponent ID="56082556" Module="trendgraph" Row="0" Column="0" RowSpan="1" ColumnSpan="1" />
<GraphComponent ID="56082556" Module="trendgraph" Row="1" Column="0" RowSpan="1" ColumnSpan="1" />
<GraphComponent ID="24898733" Module="scangraph" Row="0" Column="0" RowSpan="1" ColumnSpan="1" />
</Graphs>
</GraphTabItem>
<GraphTabItem Header="定 点" ColumnCount="1" RowCount="2">
......@@ -77,5 +91,6 @@
</ControllerStates>
<DynAreaItems>
<DynAreaComponent ID="43395070" Module="FLY.FeedbackRenZiJia.UI.Client.UIModule.UIModule_DynAreaFB" />
<DynAreaComponent ID="25339754" Module="FLY.Weight.UI.Client.UIModule.UIModule_DynArea" />
</DynAreaItems>
</FLYLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FLYLayout DynAreaWidth="250" IsDynAreaVisible="True" Left="0" Top="2" Width="1366" Height="768" WindowState="Maximized">
<Items>
<GraphTabItem Header="收 卷" ColumnCount="1" RowCount="1">
<GraphTabItem Header="称 重" ColumnCount="1" RowCount="2">
<ColumnDefinitions>
<Boolean value="False" />
</ColumnDefinitions>
<RowDefinitions>
<Boolean value="False" />
</RowDefinitions>
<Graphs>
<GraphComponent ID="49956960" Module="FLY.Winder.UI.Client.UIModule.UIModule_Main" Row="0" Column="0" RowSpan="1" ColumnSpan="1" />
</Graphs>
</GraphTabItem>
<GraphTabItem Header="称 重" ColumnCount="1" RowCount="1">
<ColumnDefinitions>
<Boolean value="False" />
</ColumnDefinitions>
<RowDefinitions>
<Boolean value="False" />
</RowDefinitions>
<Graphs>
<GraphComponent ID="60426628" Module="FLY.Weight.UI.Client.UIModule.UIModule_Main" Row="0" Column="0" RowSpan="1" ColumnSpan="1" />
</Graphs>
</GraphTabItem>
<GraphTabItem Header="I B C" ColumnCount="1" RowCount="1">
<ColumnDefinitions>
<Boolean value="False" />
</ColumnDefinitions>
<RowDefinitions>
<Boolean value="False" />
<Boolean value="False" />
</RowDefinitions>
<Graphs>
<GraphComponent ID="65203096" Module="FLY.IBC.UI.Client.UIModule.UIModule_Main" Row="0" Column="0" RowSpan="1" ColumnSpan="1" />
<GraphComponent ID="25136147" Module="FLY.Weight.UI.Client.UIModule.UIModule_FlowGraph" Row="1" Column="0" RowSpan="1" ColumnSpan="1" />
</Graphs>
</GraphTabItem>
<GraphTabItem Header="风 环" ColumnCount="1" RowCount="4">
......@@ -88,8 +67,8 @@
<Boolean value="False" />
</RowDefinitions>
<Graphs>
<GraphComponent ID="56082556" Module="trendgraph" Row="0" Column="0" RowSpan="1" ColumnSpan="1" />
<GraphComponent ID="36196647" Module="FLY.Weight.UI.Client.UIModule.UIModule_FlowGraph" Row="1" Column="0" RowSpan="1" ColumnSpan="1" />
<GraphComponent ID="56082556" Module="trendgraph" Row="1" Column="0" RowSpan="1" ColumnSpan="1" />
<GraphComponent ID="24898733" Module="scangraph" Row="0" Column="0" RowSpan="1" ColumnSpan="1" />
</Graphs>
</GraphTabItem>
<GraphTabItem Header="定 点" ColumnCount="1" RowCount="2">
......@@ -112,8 +91,6 @@
</ControllerStates>
<DynAreaItems>
<DynAreaComponent ID="43395070" Module="FLY.FeedbackRenZiJia.UI.Client.UIModule.UIModule_DynAreaFB" />
<DynAreaComponent ID="55011311" Module="FLY.IBC.UI.Client.UIModule.UIModule_DynArea" />
<DynAreaComponent ID="25339754" Module="FLY.Weight.UI.Client.UIModule.UIModule_DynArea" />
<DynAreaComponent ID="26731201" Module="FLY.Winder.UI.Client.UIModule.UIModule_DynArea" />
</DynAreaItems>
</FLYLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment