mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-05 00:37:19 +08:00
项目结构调整
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<Page
|
||||
x:Class="UWP.CartesianChart.Basic_Stacked_Bar.BasicStackedColumnExample"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:UWP.CartesianChart.Basic_Stacked_Bar"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:uwp="using:LiveCharts.Uwp"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<uwp:CartesianChart Series="{x:Bind SeriesCollection}" LegendLocation="Bottom">
|
||||
<uwp:CartesianChart.AxisX>
|
||||
<uwp:Axis Title="Browser"
|
||||
Labels="{x:Bind Labels}"
|
||||
Separator="{x:Bind CleanSeparator}" />
|
||||
</uwp:CartesianChart.AxisX>
|
||||
<uwp:CartesianChart.AxisY>
|
||||
<uwp:Axis Title="Usage" LabelFormatter="{x:Bind Formatter}"></uwp:Axis>
|
||||
</uwp:CartesianChart.AxisY>
|
||||
</uwp:CartesianChart>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
namespace UWP.CartesianChart.Basic_Stacked_Bar
|
||||
{
|
||||
using LiveCharts;
|
||||
using LiveCharts.Uwp;
|
||||
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class BasicStackedColumnExample : Page
|
||||
{
|
||||
public BasicStackedColumnExample()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
SeriesCollection = new SeriesCollection
|
||||
{
|
||||
new StackedColumnSeries
|
||||
{
|
||||
Values = new ChartValues<double> {4, 5, 6, 8},
|
||||
StackMode = StackMode.Values, // this is not necessary, values is the default stack mode
|
||||
DataLabels = true
|
||||
},
|
||||
new StackedColumnSeries
|
||||
{
|
||||
Values = new ChartValues<double> {2, 5, 6, 7},
|
||||
StackMode = StackMode.Values,
|
||||
DataLabels = true
|
||||
}
|
||||
};
|
||||
|
||||
//adding series updates and animates the chart
|
||||
SeriesCollection.Add(new StackedColumnSeries
|
||||
{
|
||||
Values = new ChartValues<double> { 6, 2, 7 },
|
||||
StackMode = StackMode.Values
|
||||
});
|
||||
|
||||
//adding values also updates and animates
|
||||
SeriesCollection[2].Values.Add(4d);
|
||||
|
||||
Labels = new[] { "Chrome", "Mozilla", "Opera", "IE" };
|
||||
Formatter = value => value + " Mill";
|
||||
|
||||
this.CleanSeparator = DefaultAxes.CleanSeparator;
|
||||
}
|
||||
|
||||
public Separator CleanSeparator;
|
||||
|
||||
public SeriesCollection SeriesCollection { get; set; }
|
||||
public string[] Labels { get; set; }
|
||||
public Func<double, string> Formatter { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<Page
|
||||
x:Class="UWP.CartesianChart.Basic_Stacked_Bar.BasicStackedRowPercentageExample"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:UWP.CartesianChart.Basic_Stacked_Bar"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:uwp="using:LiveCharts.Uwp"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<uwp:CartesianChart Series="{x:Bind SeriesCollection}" LegendLocation="Top" DataTooltip="{x:Bind Tooltip}">
|
||||
<uwp:CartesianChart.AxisY>
|
||||
<uwp:Axis Title="Browser" Labels="{x:Bind Labels}" />
|
||||
</uwp:CartesianChart.AxisY>
|
||||
<uwp:CartesianChart.AxisX>
|
||||
<uwp:Axis LabelFormatter="{x:Bind Formatter}" />
|
||||
</uwp:CartesianChart.AxisX>
|
||||
</uwp:CartesianChart>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
namespace UWP.CartesianChart.Basic_Stacked_Bar
|
||||
{
|
||||
using LiveCharts;
|
||||
using LiveCharts.Uwp;
|
||||
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class BasicStackedRowPercentageExample : Page
|
||||
{
|
||||
public BasicStackedRowPercentageExample()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
SeriesCollection = new SeriesCollection
|
||||
{
|
||||
new StackedRowSeries
|
||||
{
|
||||
Values = new ChartValues<double> {4, 5, 6, 8},
|
||||
StackMode = StackMode.Percentage,
|
||||
DataLabels = true,
|
||||
LabelPoint = p => p.X.ToString()
|
||||
},
|
||||
new StackedRowSeries
|
||||
{
|
||||
Values = new ChartValues<double> {2, 5, 6, 7},
|
||||
StackMode = StackMode.Percentage,
|
||||
DataLabels = true,
|
||||
LabelPoint = p => p.X.ToString()
|
||||
}
|
||||
};
|
||||
|
||||
//adding series updates and animates the chart
|
||||
SeriesCollection.Add(new StackedRowSeries
|
||||
{
|
||||
Values = new ChartValues<double> { 6, 2, 7 },
|
||||
StackMode = StackMode.Percentage,
|
||||
DataLabels = true,
|
||||
LabelPoint = p => p.X.ToString()
|
||||
});
|
||||
|
||||
//adding values also updates and animates
|
||||
SeriesCollection[2].Values.Add(4d);
|
||||
|
||||
Labels = new[] { "Chrome", "Mozilla", "Opera", "IE" };
|
||||
Formatter = val => val.ToString("P");
|
||||
|
||||
this.Tooltip = new DefaultTooltip() { SelectionMode = TooltipSelectionMode.SharedYValues };
|
||||
}
|
||||
|
||||
public UserControl Tooltip;
|
||||
|
||||
public SeriesCollection SeriesCollection { get; set; }
|
||||
public string[] Labels { get; set; }
|
||||
public Func<double, string> Formatter { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user