chart
This commit is contained in:
		
							parent
							
								
									31655bf890
								
							
						
					
					
						commit
						7ba819258f
					
				| @ -42,6 +42,14 @@ | ||||
|     <ApplicationIcon>app.ico</ApplicationIcon> | ||||
|   </PropertyGroup> | ||||
|   <ItemGroup> | ||||
|     <Reference Include="LiveCharts, Version=0.9.7.0, Culture=neutral, PublicKeyToken=0bc1f845d1ebb8df, processorArchitecture=MSIL"> | ||||
|       <HintPath>..\packages\LiveCharts.0.9.7\lib\net45\LiveCharts.dll</HintPath> | ||||
|       <Private>True</Private> | ||||
|     </Reference> | ||||
|     <Reference Include="LiveCharts.Wpf, Version=0.9.7.0, Culture=neutral, PublicKeyToken=0bc1f845d1ebb8df, processorArchitecture=MSIL"> | ||||
|       <HintPath>..\packages\LiveCharts.Wpf.0.9.7\lib\net45\LiveCharts.Wpf.dll</HintPath> | ||||
|       <Private>True</Private> | ||||
|     </Reference> | ||||
|     <Reference Include="System" /> | ||||
|     <Reference Include="System.Data" /> | ||||
|     <Reference Include="System.Xml" /> | ||||
| @ -94,6 +102,7 @@ | ||||
|       <LastGenOutput>Resources.Designer.cs</LastGenOutput> | ||||
|     </EmbeddedResource> | ||||
|     <None Include="app.manifest" /> | ||||
|     <None Include="packages.config" /> | ||||
|     <None Include="Properties\Settings.settings"> | ||||
|       <Generator>SettingsSingleFileGenerator</Generator> | ||||
|       <LastGenOutput>Settings.Designer.cs</LastGenOutput> | ||||
|  | ||||
							
								
								
									
										19
									
								
								FastGithub.UI/LineChart.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								FastGithub.UI/LineChart.xaml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,19 @@ | ||||
| <UserControl x:Class="FastGithub.UI.LineChart" | ||||
|            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||||
|              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||||
|              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"  | ||||
|              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||||
|              xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"  | ||||
|              mc:Ignorable="d"  | ||||
|              d:DesignHeight="300" d:DesignWidth="300"> | ||||
|     <Grid> | ||||
|         <lvc:CartesianChart Name="flowChart" Series="{Binding SeriesCollection}" LegendLocation="Right" > | ||||
|             <lvc:CartesianChart.AxisY> | ||||
|                 <lvc:Axis Title="速率" LabelFormatter="{Binding YFormatter}"></lvc:Axis> | ||||
|             </lvc:CartesianChart.AxisY> | ||||
|             <lvc:CartesianChart.AxisX> | ||||
|                 <lvc:Axis Title="时间" Labels="{Binding Labels}"></lvc:Axis> | ||||
|             </lvc:CartesianChart.AxisX> | ||||
|         </lvc:CartesianChart> | ||||
|     </Grid> | ||||
| </UserControl> | ||||
							
								
								
									
										35
									
								
								FastGithub.UI/LineChart.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								FastGithub.UI/LineChart.xaml.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,35 @@ | ||||
| using LiveCharts; | ||||
| using LiveCharts.Wpf; | ||||
| using System; | ||||
| using System.Windows.Controls; | ||||
| 
 | ||||
| namespace FastGithub.UI | ||||
| { | ||||
|     /// <summary> | ||||
|     /// LineChart.xaml 的交互逻辑 | ||||
|     /// </summary> | ||||
|     public partial class LineChart : UserControl | ||||
|     { | ||||
|         public SeriesCollection SeriesCollection { get; } = new SeriesCollection(); | ||||
| 
 | ||||
|         public string[] Labels { get; set; } | ||||
| 
 | ||||
|         public Func<double, string> YFormatter { get; set; }= value => value.ToString("0.00"); | ||||
| 
 | ||||
|         public LineSeries ReadSeries { get; } = new LineSeries(); | ||||
| 
 | ||||
|         public LineSeries WriteSeries { get; } = new LineSeries(); | ||||
| 
 | ||||
|         public LineChart() | ||||
|         {  | ||||
|             InitializeComponent(); | ||||
|            | ||||
|             this.SeriesCollection.Add(this.ReadSeries); | ||||
|             this.SeriesCollection.Add(this.WriteSeries); | ||||
| 
 | ||||
|             DataContext = this; | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|     } | ||||
| } | ||||
							
								
								
									
										5
									
								
								FastGithub.UI/packages.config
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								FastGithub.UI/packages.config
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <packages> | ||||
|   <package id="LiveCharts" version="0.9.7" targetFramework="net45" /> | ||||
|   <package id="LiveCharts.Wpf" version="0.9.7" targetFramework="net45" /> | ||||
| </packages> | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user