How to set the Y-axis interval exponentially in column series?
如何在列级数中指数地设置y轴间隔?
new ColumnSeries
{
Fill = new SolidColorBrush(Color.FromRgb(30,130,173)),
Width = 100,
MaxColumnWidth = 100,
Values = new ChartValues<double> {500,30,10},
DataLabels = true,
LabelPoint = point => point.Y +"",
FontSize = 20
}
1 个解决方案
#1
0
You can configure your y-axis with a logarithmic scale - there's an explanation of how to do this on the Live Charts site https://lvcharts.net/App/examples/v1/wpf/Logarithmic%20Scale
你可以用对数尺度来配置你的y轴——有一个关于如何在实时图表网站https://lvcharts.net/app/examples/v1/wpf/logmic%20scale上做到这一点的解释
Here's an example adapted for a column series:
下面是一个适合于列系列的示例:
public SeriesCollection SeriesCollection { get; set; }
public MainWindow()
{
InitializeComponent();
var mapper = Mappers.Xy<double>()
.X((value, index) => index)
.Y((value, index) => Math.Log(value, 10));
SeriesCollection = new SeriesCollection(mapper)
{
new ColumnSeries
{
Values = new ChartValues<double>{500,30,10}
}
};
DataContext = this;
}
and the XAML:
XAML:
<Grid>
<lvc:CartesianChart Series="{Binding SeriesCollection}">
<lvc:CartesianChart.AxisY>
<lvc:LogarithmicAxis Base="10" />
</lvc:CartesianChart.AxisY>
</lvc:CartesianChart>
</Grid>
#1
0
You can configure your y-axis with a logarithmic scale - there's an explanation of how to do this on the Live Charts site https://lvcharts.net/App/examples/v1/wpf/Logarithmic%20Scale
你可以用对数尺度来配置你的y轴——有一个关于如何在实时图表网站https://lvcharts.net/app/examples/v1/wpf/logmic%20scale上做到这一点的解释
Here's an example adapted for a column series:
下面是一个适合于列系列的示例:
public SeriesCollection SeriesCollection { get; set; }
public MainWindow()
{
InitializeComponent();
var mapper = Mappers.Xy<double>()
.X((value, index) => index)
.Y((value, index) => Math.Log(value, 10));
SeriesCollection = new SeriesCollection(mapper)
{
new ColumnSeries
{
Values = new ChartValues<double>{500,30,10}
}
};
DataContext = this;
}
and the XAML:
XAML:
<Grid>
<lvc:CartesianChart Series="{Binding SeriesCollection}">
<lvc:CartesianChart.AxisY>
<lvc:LogarithmicAxis Base="10" />
</lvc:CartesianChart.AxisY>
</lvc:CartesianChart>
</Grid>