1个回答
展开全部
1.后台程序:加载一条随即曲线,横轴为时间
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Windows;
using System.IO;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Globalization;
using System.Diagnostics;
using System.Windows.Threading;
using Microsoft.Research.DynamicDataDisplay;
using Microsoft.Research.DynamicDataDisplay.DataSources;
using Microsoft.Research.DynamicDataDisplay.PointMarkers;
using Microsoft.Research.DynamicDataDisplay.Charts.Navigation;
namespace WpfApplication2
{
public partial class MainWindow : Window
{
Random random = new Random();
private DispatcherTimer timer = new DispatcherTimer();
CompositeDataSource compositeDataSource1;
CompositeDataSource compositeDataSource2;
EnumerableDataSource<DateTime> datesDataSource = null;
EnumerableDataSource<int> numberOpenDataSource=null;
EnumerableDataSource<int> numberClosedDataSource = null;
List<DateTime> vardatetime = new List<DateTime>();
int i = 0;
List<int> numberOpen = new List<int>();
List<int> numberClosed = new List<int>();
/*
int[] numberOpen = new int[100];
int[] numberClosed = new int[100];
*/
public MainWindow()
{
InitializeComponent();
// Loaded += new RoutedEventHandler(Window_Loaded);
}
private void Window1_Loaded(object sender, EventArgs e)
{
DateTime tempDateTime = new DateTime();
tempDateTime = DateTime.Now;
vardatetime.Add(tempDateTime);
numberOpen.Add(random.Next(40));
numberClosed.Add(random.Next(100));
datesDataSource.RaiseDataChanged();
numberOpenDataSource.RaiseDataChanged();
numberClosedDataSource.RaiseDataChanged();
i++;
} // Window1_Loaded()
private void Window_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
DateTime tempDateTime=new DateTime();
tempDateTime = DateTime.Now;
vardatetime.Add(tempDateTime);
numberOpen.Add(random.Next(40));
numberClosed.Add(random.Next(100));
i++;
datesDataSource = new EnumerableDataSource<DateTime>(vardatetime);
datesDataSource.SetXMapping(x => dateAxis.ConvertToDouble(x));
numberOpenDataSource = new EnumerableDataSource<int>(numberOpen);
numberOpenDataSource.SetYMapping(y => y);
numberClosedDataSource = new EnumerableDataSource<int>(numberClosed);
numberClosedDataSource.SetYMapping(y => y);
compositeDataSource1 = new CompositeDataSource(datesDataSource, numberOpenDataSource);
compositeDataSource2 = new CompositeDataSource(datesDataSource, numberClosedDataSource);
plotter.AddLineGraph(compositeDataSource2, Colors.Green, 1, "Percentage2");
plotter.Viewport.FitToView();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += new EventHandler(Window1_Loaded);
timer.IsEnabled = true;
}
} // class Window1
}
2.前台展示程序
<Window x:Class="WpfApplication2.MainWindow"
xmlns=
xmlns:x=
xmlns:d3=
Title="Window1" Loaded="Window_Loaded" WindowState="Normal" Height="800" Width="1280" Background="Wheat">
<Grid>
<d3:ChartPlotter Name="plotter" Margin="10,10,20,10">
<d3:ChartPlotter.HorizontalAxis>
<d3:HorizontalDateTimeAxis Name="dateAxis"/>
</d3:ChartPlotter.HorizontalAxis>
<d3:ChartPlotter.VerticalAxis>
<d3:VerticalIntegerAxis Name="countAxis"/>
</d3:ChartPlotter.VerticalAxis>
<d3:Header FontFamily="Arial" Content="Bug Information"/>
<d3:VerticalAxisTitle FontFamily="Arial" Content="Count"/>
<d3:HorizontalAxisTitle FontFamily="Arial" Content="Date"/>
</d3:ChartPlotter>
</Grid>
</Window>
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Windows;
using System.IO;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Globalization;
using System.Diagnostics;
using System.Windows.Threading;
using Microsoft.Research.DynamicDataDisplay;
using Microsoft.Research.DynamicDataDisplay.DataSources;
using Microsoft.Research.DynamicDataDisplay.PointMarkers;
using Microsoft.Research.DynamicDataDisplay.Charts.Navigation;
namespace WpfApplication2
{
public partial class MainWindow : Window
{
Random random = new Random();
private DispatcherTimer timer = new DispatcherTimer();
CompositeDataSource compositeDataSource1;
CompositeDataSource compositeDataSource2;
EnumerableDataSource<DateTime> datesDataSource = null;
EnumerableDataSource<int> numberOpenDataSource=null;
EnumerableDataSource<int> numberClosedDataSource = null;
List<DateTime> vardatetime = new List<DateTime>();
int i = 0;
List<int> numberOpen = new List<int>();
List<int> numberClosed = new List<int>();
/*
int[] numberOpen = new int[100];
int[] numberClosed = new int[100];
*/
public MainWindow()
{
InitializeComponent();
// Loaded += new RoutedEventHandler(Window_Loaded);
}
private void Window1_Loaded(object sender, EventArgs e)
{
DateTime tempDateTime = new DateTime();
tempDateTime = DateTime.Now;
vardatetime.Add(tempDateTime);
numberOpen.Add(random.Next(40));
numberClosed.Add(random.Next(100));
datesDataSource.RaiseDataChanged();
numberOpenDataSource.RaiseDataChanged();
numberClosedDataSource.RaiseDataChanged();
i++;
} // Window1_Loaded()
private void Window_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
DateTime tempDateTime=new DateTime();
tempDateTime = DateTime.Now;
vardatetime.Add(tempDateTime);
numberOpen.Add(random.Next(40));
numberClosed.Add(random.Next(100));
i++;
datesDataSource = new EnumerableDataSource<DateTime>(vardatetime);
datesDataSource.SetXMapping(x => dateAxis.ConvertToDouble(x));
numberOpenDataSource = new EnumerableDataSource<int>(numberOpen);
numberOpenDataSource.SetYMapping(y => y);
numberClosedDataSource = new EnumerableDataSource<int>(numberClosed);
numberClosedDataSource.SetYMapping(y => y);
compositeDataSource1 = new CompositeDataSource(datesDataSource, numberOpenDataSource);
compositeDataSource2 = new CompositeDataSource(datesDataSource, numberClosedDataSource);
plotter.AddLineGraph(compositeDataSource2, Colors.Green, 1, "Percentage2");
plotter.Viewport.FitToView();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += new EventHandler(Window1_Loaded);
timer.IsEnabled = true;
}
} // class Window1
}
2.前台展示程序
<Window x:Class="WpfApplication2.MainWindow"
xmlns=
xmlns:x=
xmlns:d3=
Title="Window1" Loaded="Window_Loaded" WindowState="Normal" Height="800" Width="1280" Background="Wheat">
<Grid>
<d3:ChartPlotter Name="plotter" Margin="10,10,20,10">
<d3:ChartPlotter.HorizontalAxis>
<d3:HorizontalDateTimeAxis Name="dateAxis"/>
</d3:ChartPlotter.HorizontalAxis>
<d3:ChartPlotter.VerticalAxis>
<d3:VerticalIntegerAxis Name="countAxis"/>
</d3:ChartPlotter.VerticalAxis>
<d3:Header FontFamily="Arial" Content="Bug Information"/>
<d3:VerticalAxisTitle FontFamily="Arial" Content="Count"/>
<d3:HorizontalAxisTitle FontFamily="Arial" Content="Date"/>
</d3:ChartPlotter>
</Grid>
</Window>
本回答被提问者和网友采纳
光点科技
2023-08-15 广告
2023-08-15 广告
通常情况下,我们会按照结构模型把系统产生的数据分为三种类型:结构化数据、半结构化数据和非结构化数据。结构化数据,即行数据,是存储在数据库里,可以用二维表结构来逻辑表达实现的数据。最常见的就是数字数据和文本数据,它们可以某种标准格式存在于文件...
点击进入详情页
本回答由光点科技提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询