mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-02 07:06:37 +08:00
项目结构调整
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<Page
|
||||
x:Class="UWP.CartesianChart.NegativeStackedRow.NegativeStackedRowExample"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:UWP.CartesianChart.NegativeStackedRow"
|
||||
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}">
|
||||
<lvc:CartesianChart.AxisX>
|
||||
<lvc:Axis LabelFormatter="{Binding Formatter}"></lvc:Axis>
|
||||
</lvc:CartesianChart.AxisX>
|
||||
<lvc:CartesianChart.AxisY>
|
||||
<lvc:Axis Title="Age Range" Labels="{Binding Labels}"></lvc:Axis>
|
||||
</lvc:CartesianChart.AxisY>
|
||||
<lvc:CartesianChart.DataTooltip>
|
||||
<lvc:DefaultTooltip SelectionMode="SharedYValues"></lvc:DefaultTooltip>
|
||||
</lvc:CartesianChart.DataTooltip>
|
||||
</lvc:CartesianChart>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,44 @@
|
||||
using LiveCharts;
|
||||
using LiveCharts.Uwp;
|
||||
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.NegativeStackedRow
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class NegativeStackedRowExample : Page
|
||||
{
|
||||
public NegativeStackedRowExample()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
SeriesCollection = new SeriesCollection
|
||||
{
|
||||
new StackedRowSeries
|
||||
{
|
||||
Title = "Male",
|
||||
Values = new ChartValues<double> {.5, .7, .8, .8, .6, .2, .6}
|
||||
},
|
||||
new StackedRowSeries
|
||||
{
|
||||
Title = "Female",
|
||||
Values = new ChartValues<double> {-.5, -.7, -.8, -.8, -.6, -.2, -.6}
|
||||
}
|
||||
};
|
||||
|
||||
Labels = new[] { "0-20", "20-35", "35-45", "45-55", "55-65", "65-70", ">70" };
|
||||
Formatter = value => Math.Abs(value).ToString("P");
|
||||
|
||||
DataContext = this;
|
||||
|
||||
}
|
||||
|
||||
public SeriesCollection SeriesCollection { get; set; }
|
||||
public string[] Labels { get; set; }
|
||||
public Func<double, string> Formatter { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user