mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-02 15:16:37 +08:00
项目结构调整
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
<Page
|
||||
x:Class="UWP.CartesianChart.LogarithmScale.LogarithmScaleExample"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:UWP.CartesianChart.LogarithmScale"
|
||||
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:LogarithmicAxis LabelFormatter="{Binding Formatter}" Base="10" />
|
||||
</lvc:CartesianChart.AxisX>
|
||||
</lvc:CartesianChart>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,51 @@
|
||||
using LiveCharts;
|
||||
using LiveCharts.Configurations;
|
||||
using LiveCharts.Defaults;
|
||||
using LiveCharts.Definitions.Charts;
|
||||
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.LogarithmScale
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class LogarithmScaleExample : Page
|
||||
{
|
||||
public LogarithmScaleExample()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
SeriesCollection = new SeriesCollection(Mappers.Xy<ObservablePoint>()
|
||||
.X(point => Math.Log10(point.X))
|
||||
.Y(point => point.Y))
|
||||
{
|
||||
new LineSeries
|
||||
{
|
||||
Values = new ChartValues<ObservablePoint>
|
||||
{
|
||||
new ObservablePoint(1, 5),
|
||||
new ObservablePoint(10, 6),
|
||||
new ObservablePoint(100, 4),
|
||||
new ObservablePoint(1000, 2),
|
||||
new ObservablePoint(10000, 8),
|
||||
new ObservablePoint(100000, 2),
|
||||
new ObservablePoint(1000000, 9),
|
||||
new ObservablePoint(10000000, 8)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Formatter = value => Math.Pow(10, value).ToString("N");
|
||||
|
||||
DataContext = this;
|
||||
}
|
||||
|
||||
public SeriesCollection SeriesCollection { get; set; }
|
||||
public Func<double, string> Formatter { get; set; }
|
||||
public ISeparatorView CleanSeparator { get; set; } = DefaultAxes.CleanSeparator;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user