mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-16 06:26:37 +08:00
项目结构调整
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<Page
|
||||
x:Class="UWP.CartesianChart.BasicLine.BasicLineExample"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:UWP.CartesianChart.BasicLine"
|
||||
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}">
|
||||
<lvc:CartesianChart Series="{Binding SeriesCollection}" LegendLocation="Right" >
|
||||
<lvc:CartesianChart.AxisY>
|
||||
<lvc:Axis Title="Sales" LabelFormatter="{Binding YFormatter}"></lvc:Axis>
|
||||
</lvc:CartesianChart.AxisY>
|
||||
<lvc:CartesianChart.AxisX>
|
||||
<lvc:Axis Title="Month" Labels="{Binding Labels}"></lvc:Axis>
|
||||
</lvc:CartesianChart.AxisX>
|
||||
</lvc:CartesianChart>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,67 @@
|
||||
using LiveCharts;
|
||||
using LiveCharts.Uwp;
|
||||
using System;
|
||||
using Windows.UI;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Media;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
namespace UWP.CartesianChart.BasicLine
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class BasicLineExample : Page
|
||||
{
|
||||
public BasicLineExample()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
SeriesCollection = new SeriesCollection
|
||||
{
|
||||
new LineSeries
|
||||
{
|
||||
Title = "Series 1",
|
||||
Values = new ChartValues<double> { 4, 6, 5, 2 ,4 }
|
||||
},
|
||||
new LineSeries
|
||||
{
|
||||
Title = "Series 2",
|
||||
Values = new ChartValues<double> { 6, 7, 3, 4 ,6 },
|
||||
PointGeometry = DefaultGeometries.None
|
||||
},
|
||||
new LineSeries
|
||||
{
|
||||
Title = "Series 3",
|
||||
Values = new ChartValues<double> { 4,2,7,2,7 },
|
||||
PointGeometry = DefaultGeometries.Square,
|
||||
PointGeometrySize = 15
|
||||
}
|
||||
};
|
||||
|
||||
Labels = new[] { "Jan", "Feb", "Mar", "Apr", "May" };
|
||||
YFormatter = value => value.ToString("C");
|
||||
|
||||
//modifying the series collection will animate and update the chart
|
||||
SeriesCollection.Add(new LineSeries
|
||||
{
|
||||
Title = "Series 4",
|
||||
Values = new ChartValues<double> { 5, 3, 2, 4 },
|
||||
LineSmoothness = 0, //0: straight lines, 1: really smooth lines
|
||||
PointGeometry = new PointGeometry("m0,50 l25,30 l60,-80 l-60 60z"),
|
||||
PointGeometrySize = 50,
|
||||
PointForeround = new SolidColorBrush(Colors.Gray)
|
||||
});
|
||||
|
||||
//modifying any series values will also animate and update the chart
|
||||
SeriesCollection[3].Values.Add(5d);
|
||||
|
||||
DataContext = this;
|
||||
}
|
||||
|
||||
public SeriesCollection SeriesCollection { get; set; }
|
||||
public string[] Labels { get; set; }
|
||||
public Func<double, string> YFormatter { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user