He creado un cuadro con el kit de herramientas de gráficos WPF Toolkit (3.5) y no puedo obtener las etiquetas del eje y para mostrar números pequeños (por ejemplo, .001) Establecí los valores mínimos y máximos en .001 y .009 respectivamente para el eje y, y aunque el diagrama es gráficamente correcto, las etiquetas de rango del eje y muestran "0" o ".01". Supongo que esto es una limitación del control de gráfico en el kit de herramientas 3.5, pero espero que me falta algo. Aquí hay un código de ejemplo:Las etiquetas del eje y del juego de herramientas de gráficos WPF aparecen como cero para números pequeños
XAML:
<Window x:Class="WpfChartApplication.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525"
xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit">
<Grid>
<chartingToolkit:Chart Name="chart1">
<chartingToolkit:LineSeries
Title="Rates"
ItemsSource="{Binding Rates}"
IndependentValueBinding="{Binding Time}"
DependentValueBinding="{Binding Value}"
>
<chartingToolkit:LineSeries.DependentRangeAxis>
<chartingToolkit:LinearAxis
Orientation="Y"
Title="Y Value"
ShowGridLines="True"
Maximum=".009"
Minimum=".001"/>
</chartingToolkit:LineSeries.DependentRangeAxis>
</chartingToolkit:LineSeries>
<chartingToolkit:Chart.Axes>
<chartingToolkit:LinearAxis Orientation="X"
Title="X Value"
ShowGridLines="True"
/>
</chartingToolkit:Chart.Axes>
</chartingToolkit:Chart>
</Grid>
Y el código subyacente:
using System.Collections.Generic;
using System.Windows;
namespace WpfChartApplication
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
var cVm = new ChartViewModel();
chart1.DataContext = cVm;
}
}
public class ChartViewModel
{
public List<Rate> Rates { get; set; }
public ChartViewModel()
{
Rates = new List<Rate>();
Rates.Add(new Rate(1, .001));
Rates.Add(new Rate(2, .003));
Rates.Add(new Rate(3, .001));
Rates.Add(new Rate(4, .002));
Rates.Add(new Rate(5, .001));
Rates.Add(new Rate(6, .001));
Rates.Add(new Rate(7, .003));
Rates.Add(new Rate(8, .007));
Rates.Add(new Rate(9, .009));
Rates.Add(new Rate(10, .008));
}
}
public class Rate
{
public Rate(int time, double value)
{
Time = time;
Value = value;
}
public int Time { get; set; }
public double Value { get; set; }
}
}
Me sorprende que este no sea el comportamiento predeterminado para el control de gráfico. ¡Gracias por tu ayuda! –
@senor_cardgage no hay problema :-) – punker76