|
|
|
@ -0,0 +1,121 @@ |
|
|
|
|
using LiveCharts; |
|
|
|
|
using LiveCharts.Defaults; |
|
|
|
|
using System; |
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
using System.Linq; |
|
|
|
|
using System.Text; |
|
|
|
|
using System.Threading.Tasks; |
|
|
|
|
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 Tutorial.BasicPlots |
|
|
|
|
{ |
|
|
|
|
/// <summary> |
|
|
|
|
/// HeatMapWindow.xaml에 대한 상호 작용 논리 |
|
|
|
|
/// </summary> |
|
|
|
|
public partial class HeatMapWindow : Window |
|
|
|
|
{ |
|
|
|
|
public ChartValues<HeatPoint> Values { get; set; } |
|
|
|
|
public string[] Days { get; set; } |
|
|
|
|
public string[] Salesman { get; set; } |
|
|
|
|
|
|
|
|
|
public HeatMapWindow() |
|
|
|
|
{ |
|
|
|
|
InitializeComponent(); |
|
|
|
|
InitInstance(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected virtual void InitInstance() |
|
|
|
|
{ |
|
|
|
|
Random rand = new Random(); |
|
|
|
|
|
|
|
|
|
Values = new ChartValues<HeatPoint> |
|
|
|
|
{ |
|
|
|
|
//X means sales man |
|
|
|
|
//Y is the day |
|
|
|
|
|
|
|
|
|
//"Jeremy Swanson" |
|
|
|
|
new HeatPoint(0, 0, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(0, 1, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(0, 2, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(0, 3, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(0, 4, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(0, 5, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(0, 6, rand.Next(0, 10)), |
|
|
|
|
|
|
|
|
|
//"Lorena Hoffman" |
|
|
|
|
new HeatPoint(1, 0, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(1, 1, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(1, 2, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(1, 3, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(1, 4, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(1, 5, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(1, 6, rand.Next(0, 10)), |
|
|
|
|
|
|
|
|
|
//"Robyn Williamson" |
|
|
|
|
new HeatPoint(2, 0, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(2, 1, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(2, 2, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(2, 3, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(2, 4, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(2, 5, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(2, 6, rand.Next(0, 10)), |
|
|
|
|
|
|
|
|
|
//"Carole Haynes" |
|
|
|
|
new HeatPoint(3, 0, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(3, 1, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(3, 2, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(3, 3, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(3, 4, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(3, 5, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(3, 6, rand.Next(0, 10)), |
|
|
|
|
|
|
|
|
|
//"Essie Nelson" |
|
|
|
|
new HeatPoint(4, 0, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(4, 1, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(4, 2, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(4, 3, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(4, 4, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(4, 5, rand.Next(0, 10)), |
|
|
|
|
new HeatPoint(4, 6, rand.Next(0, 10)) |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
Days = new[] |
|
|
|
|
{ |
|
|
|
|
"Monday", |
|
|
|
|
"Tuesday", |
|
|
|
|
"Wednesday", |
|
|
|
|
"Thursday", |
|
|
|
|
"Friday", |
|
|
|
|
"Saturday", |
|
|
|
|
"Sunday" |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
Salesman = new[] |
|
|
|
|
{ |
|
|
|
|
"Jeremy Swanson", |
|
|
|
|
"Lorena Hoffman", |
|
|
|
|
"Robyn Williamson", |
|
|
|
|
"Carole Haynes", |
|
|
|
|
"Essie Nelson" |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
DataContext = this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void btnRandomize_Click(object sender, RoutedEventArgs e) |
|
|
|
|
{ |
|
|
|
|
Random rand = new Random(); |
|
|
|
|
foreach (var chartValue in Values) |
|
|
|
|
{ |
|
|
|
|
chartValue.Weight = rand.Next(0, 10); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |