using LiveCharts; using LiveCharts.Wpf; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; 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.Shapes; namespace ITE.client { /// /// CommBoard.xaml 的交互逻辑 /// public partial class CommBoard : Window { public CommBoard() { InitializeComponent(); //baseLine. } private void Grid_Loaded(object sender, RoutedEventArgs e) { BindBasicColumn(); BindBaseLine(); } /// /// 绑定Line报表 /// private void BindBaseLine() { baseLine.SeriesCollection = new SeriesCollection { new LineSeries { Title = "总装A线\r\n工位不良率", Values = new ChartValues { 0.70, 0.80, 0.70, 0.80 ,0.85 } } }; baseLine.TitleX = "日期"; baseLine.TitleX = "不良率"; baseLine.Labels = new[] { "2017-03-20", "2017-03-21", "2017-03-22", "2017-03-23", "2017-03-24" }; baseLine.YFormatter = value => string.Format("{0:0.00%}", value); baseLine.DataContext = baseLine; } /// /// 绑定Line报表 /// private void BindBasicColumn() { baseColumn.SeriesCollection = new SeriesCollection { new ColumnSeries { Title = "", Values = new ChartValues { 10,25, 18, 17 ,15,12,13 } } }; baseColumn.xTittle.Title ="模块" ; baseColumn.yTittle.Title = "数量" ; baseColumn.Labels = new[] { "a", "b", "c", "d", "e","f","g"}; baseColumn.YFormatter = value => value.ToString("N"); baseColumn.DataContext = baseColumn; } } }