You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.2 KiB
C#

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
{
/// <summary>
/// CommBoard.xaml 的交互逻辑
/// </summary>
public partial class CommBoard : Window
{
public CommBoard()
{
InitializeComponent();
//baseLine.
}
private void Grid_Loaded(object sender, RoutedEventArgs e)
{
BindBasicColumn();
BindBaseLine();
}
/// <summary>
/// 绑定Line报表
/// </summary>
private void BindBaseLine()
{
baseLine.SeriesCollection = new SeriesCollection
{
new LineSeries
{
Title = "总装A线\r\n工位不良率",
Values = new ChartValues<double> { 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;
}
/// <summary>
/// 绑定Line报表
/// </summary>
private void BindBasicColumn()
{
baseColumn.SeriesCollection = new SeriesCollection
{
new ColumnSeries
{
Title = "",
Values = new ChartValues<double> { 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;
}
}
}