mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-04 08:06:36 +08:00
项目结构调整
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<Page
|
||||
x:Class="UWP.CartesianChart.HeatChart.HeatSeriesExample"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:UWP.CartesianChart.HeatChart"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:lvc="using:LiveCharts.Uwp"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Button Grid.Row="0" Height="30" Width="100" Click="ButtonBase_OnClick" Margin="10">Randomize</Button>
|
||||
<lvc:CartesianChart Grid.Row="1" DataTooltip="{x:Null}">
|
||||
<lvc:CartesianChart.Series>
|
||||
<lvc:HeatSeries Values="{Binding Values}" DataLabels="True">
|
||||
|
||||
<!--
|
||||
The GradientStopCollection is optional to define a custom gradient
|
||||
If this property is not specified, LiveCharts will set a gradient
|
||||
-->
|
||||
|
||||
<lvc:HeatSeries.GradientStopCollection>
|
||||
<GradientStop Offset="0" Color="#99FFFF00"></GradientStop>
|
||||
<GradientStop Offset=".25" Color="#FFFFFF00"></GradientStop>
|
||||
<GradientStop Offset=".50" Color="#990000FF"></GradientStop>
|
||||
<GradientStop Offset=".75" Color="#FF0000FF"></GradientStop>
|
||||
<GradientStop Offset="1" Color="#50505050"></GradientStop>
|
||||
</lvc:HeatSeries.GradientStopCollection>
|
||||
</lvc:HeatSeries>
|
||||
</lvc:CartesianChart.Series>
|
||||
<lvc:CartesianChart.AxisX >
|
||||
<lvc:Axis Labels="{Binding SalesMan}" LabelsRotation="-15">
|
||||
<lvc:Axis.Separator>
|
||||
<lvc:Separator Step="1"></lvc:Separator>
|
||||
</lvc:Axis.Separator>
|
||||
</lvc:Axis>
|
||||
</lvc:CartesianChart.AxisX>
|
||||
<lvc:CartesianChart.AxisY>
|
||||
<lvc:Axis Labels="{Binding Days}"></lvc:Axis>
|
||||
</lvc:CartesianChart.AxisY>
|
||||
</lvc:CartesianChart>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,109 @@
|
||||
using LiveCharts;
|
||||
using LiveCharts.Defaults;
|
||||
using System;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
namespace UWP.CartesianChart.HeatChart
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class HeatSeriesExample : Page
|
||||
{
|
||||
public HeatSeriesExample()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var r = new Random();
|
||||
|
||||
Values = new ChartValues<HeatPoint>
|
||||
{
|
||||
//X means sales man
|
||||
//Y is the day
|
||||
|
||||
//"Jeremy Swanson"
|
||||
new HeatPoint(0, 0, r.Next(0, 10)),
|
||||
new HeatPoint(0, 1, r.Next(0, 10)),
|
||||
new HeatPoint(0, 2, r.Next(0, 10)),
|
||||
new HeatPoint(0, 3, r.Next(0, 10)),
|
||||
new HeatPoint(0, 4, r.Next(0, 10)),
|
||||
new HeatPoint(0, 5, r.Next(0, 10)),
|
||||
new HeatPoint(0, 6, r.Next(0, 10)),
|
||||
|
||||
//"Lorena Hoffman"
|
||||
new HeatPoint(1, 0, r.Next(0, 10)),
|
||||
new HeatPoint(1, 1, r.Next(0, 10)),
|
||||
new HeatPoint(1, 2, r.Next(0, 10)),
|
||||
new HeatPoint(1, 3, r.Next(0, 10)),
|
||||
new HeatPoint(1, 4, r.Next(0, 10)),
|
||||
new HeatPoint(1, 5, r.Next(0, 10)),
|
||||
new HeatPoint(1, 6, r.Next(0, 10)),
|
||||
|
||||
//"Robyn Williamson"
|
||||
new HeatPoint(2, 0, r.Next(0, 10)),
|
||||
new HeatPoint(2, 1, r.Next(0, 10)),
|
||||
new HeatPoint(2, 2, r.Next(0, 10)),
|
||||
new HeatPoint(2, 3, r.Next(0, 10)),
|
||||
new HeatPoint(2, 4, r.Next(0, 10)),
|
||||
new HeatPoint(2, 5, r.Next(0, 10)),
|
||||
new HeatPoint(2, 6, r.Next(0, 10)),
|
||||
|
||||
//"Carole Haynes"
|
||||
new HeatPoint(3, 0, r.Next(0, 10)),
|
||||
new HeatPoint(3, 1, r.Next(0, 10)),
|
||||
new HeatPoint(3, 2, r.Next(0, 10)),
|
||||
new HeatPoint(3, 3, r.Next(0, 10)),
|
||||
new HeatPoint(3, 4, r.Next(0, 10)),
|
||||
new HeatPoint(3, 5, r.Next(0, 10)),
|
||||
new HeatPoint(3, 6, r.Next(0, 10)),
|
||||
|
||||
//"Essie Nelson"
|
||||
new HeatPoint(4, 0, r.Next(0, 10)),
|
||||
new HeatPoint(4, 1, r.Next(0, 10)),
|
||||
new HeatPoint(4, 2, r.Next(0, 10)),
|
||||
new HeatPoint(4, 3, r.Next(0, 10)),
|
||||
new HeatPoint(4, 4, r.Next(0, 10)),
|
||||
new HeatPoint(4, 5, r.Next(0, 10)),
|
||||
new HeatPoint(4, 6, r.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;
|
||||
}
|
||||
|
||||
public ChartValues<HeatPoint> Values { get; set; }
|
||||
public string[] Days { get; set; }
|
||||
public string[] SalesMan { get; set; }
|
||||
|
||||
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var r = new Random();
|
||||
foreach (var chartValue in Values)
|
||||
{
|
||||
chartValue.Weight = r.Next(0, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user