Oxyplot Plotmodel High AxisTickLabel 不能用多个 Y 轴完全读取
Oxyplot Plotmodel High AxisTickLabel are not fully readable with multiple Y Axes
我正在尝试调整 Y 轴之间的距离,以便用户可以阅读整个 AxisTickLabel。
有 属性 或我可以使用的东西吗?
我的 PlotModel 看起来像这样:
C#:
Plot = new PlotModel
{
Padding = new OxyThickness(0),
DefaultColors = new List<OxyColor>
{
ColorPosition,
ColorVelocity,
ColorAcceleration
},
LegendOrientation = LegendOrientation.Vertical,
LegendPlacement = LegendPlacement.Inside,
LegendPosition = LegendPosition.TopRight,
LegendBackground = OxyColor.FromAColor(200, OxyColors.White),
LegendBorder = OxyColors.Black,
PlotType = PlotType.XY
};
// YAxes
_axisPosition = new LinearAxis
{
AxislineColor = ColorPosition,
TicklineColor = ColorPosition,
TextColor = ColorPosition,
AxisTickToLabelDistance = 0,
Position = AxisPosition.Left,
Key = "position"
};
Plot.Axes.Add(_axisPosition);
_seriesPosition = new LineSeries
{
Title = (string)converter.Convert(new object[] {"", "MotionProfilePosition"}, null, null, CultureInfo.CurrentCulture) + " [" + UnitItemPosition.ToString() + "]",
YAxisKey = "position"
};
Plot.Series.Add(_seriesPosition);
_axisVelocity = new LinearAxis
{
AxislineColor = ColorVelocity,
TicklineColor = ColorVelocity,
AxisTickToLabelDistance = 0,
Position = AxisPosition.Left,
TextColor = ColorVelocity,
Key = "velocity"
};
Plot.Axes.Add(_axisVelocity);
_seriesVelocity = new LineSeries
{
Title = (string)converter.Convert(new object[] {"", "MotionProfileVelocity"}, null, null, CultureInfo.CurrentCulture) + " [" + UnitItemVelocity.ToString() + "]",
YAxisKey = "velocity"
};
Plot.Series.Add(_seriesVelocity);
_axisAcceleration = new LinearAxis
{
AxislineColor = ColorAcceleration,
TextColor = ColorAcceleration,
AxisTickToLabelDistance = 0,
Position = AxisPosition.Left,
Key = "acceleration"
};
Plot.Axes.Add(_axisAcceleration);
_seriesAcceleration = new LineSeries
{
Title = (string)converter.Convert(new object[] {"", "MotionProfileAcceleration"}, null, null, CultureInfo.CurrentCulture) + " [" + UnitItemAcceleration.ToString() + "]",
YAxisKey = "acceleration"
};
Plot.Series.Add(_seriesAcceleration);
// XAxis
_axisTime = new LinearAxis
{
Position = AxisPosition.Bottom,
Key = "time",
Unit = UnitItemTime
};
Plot.Axes.Add(_axisTime);
XAML:
<oxy:PlotView Grid.Row="0" Margin="0,0,0,15" Model="{Binding Plot, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" Tag="{Binding Path=DataContext, ElementName=MotionControlMain}" Controller="{Binding Controller, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" >
<oxy:PlotView.ContextMenu>
<ContextMenu DataContext="{Binding PlacementTarget.Tag, RelativeSource={RelativeSource Self}}">
<MenuItem IsCheckable="True" Command="{Binding UpdatePlotCommand}"
IsChecked="{Binding DisplayPosition}"
Foreground="{Binding ColorPosition, Converter={StaticResource OxyColorConverter}}">
<MenuItem.Header>
<MultiBinding Converter="{StaticResource LangConverter}">
<Binding Path="SelectedLanguage" Mode="OneWay"/>
<Binding>
<Binding.Source>MotionProfileMItemPos</Binding.Source>
</Binding>
</MultiBinding>
</MenuItem.Header>
</MenuItem>
<MenuItem IsCheckable="True" Command="{Binding UpdatePlotCommand}"
IsChecked="{Binding DisplayVelocity}"
Foreground="{Binding ColorVelocity, Converter={StaticResource OxyColorConverter}}">
<MenuItem.Header>
<MultiBinding Converter="{StaticResource LangConverter}">
<Binding Path="SelectedLanguage" Mode="OneWay"/>
<Binding>
<Binding.Source>MotionProfileMItemVelo</Binding.Source>
</Binding>
</MultiBinding>
</MenuItem.Header>
</MenuItem>
<MenuItem IsCheckable="True" Command="{Binding UpdatePlotCommand}"
IsChecked="{Binding DisplayAcceleration}"
Foreground="{Binding ColorAcceleration, Converter={StaticResource OxyColorConverter}}">
<MenuItem.Header>
<MultiBinding Converter="{StaticResource LangConverter}">
<Binding Path="SelectedLanguage" Mode="OneWay"/>
<Binding>
<Binding.Source>MotionProfileMItemAccel</Binding.Source>
</Binding>
</MultiBinding>
</MenuItem.Header>
</MenuItem>
<MenuItem IsCheckable="True" Command="{Binding UpdatePlotCommand}"
IsChecked="{Binding DisplayJerk}"
Foreground="{Binding ColorJerk, Converter={StaticResource OxyColorConverter}}">
<Separator/>
<MenuItem Command="{Binding ResetPlotCommand}">
<MenuItem.Header>
<MultiBinding Converter="{StaticResource LangConverter}">
<Binding Path="SelectedLanguage" Mode="OneWay"/>
<Binding>
<Binding.Source>MotionProfileMItemReset</Binding.Source>
</Binding>
</MultiBinding>
</MenuItem.Header>
</MenuItem>
</ContextMenu>
</oxy:PlotView.ContextMenu>
</oxy:PlotView>
作为用户,您可以 select 从给定的 3 个轴中选择您想要查看的轴。
对于更高的 TickLabelValues >1000,当值到达下一个 Y 轴时很难读取。
Screenshot Plotmodel
PositionTier 是您正在寻找的属性。这是我用来创建该图像的代码:
PlotModel = new PlotModel();
PlotModel.Axes.Add(new LinearAxis
{
Position = AxisPosition.Left,
Title = "First",
Minimum = 0,
Maximum = 10000
}) ;
PlotModel.Axes.Add(new LinearAxis
{
Position = AxisPosition.Left,
Title = "Second",
Minimum = 0,
Maximum = 10000,
PositionTier = 1
});
PlotModel.Axes.Add(new LinearAxis
{
Position = AxisPosition.Left,
Title = "Third",
Minimum = 0,
Maximum = 10000,
PositionTier = 2
});
PlotModel.Axes.Add(new LinearAxis
{
Position = AxisPosition.Bottom,
Title = "x"
});
我正在尝试调整 Y 轴之间的距离,以便用户可以阅读整个 AxisTickLabel。 有 属性 或我可以使用的东西吗?
我的 PlotModel 看起来像这样:
C#:
Plot = new PlotModel
{
Padding = new OxyThickness(0),
DefaultColors = new List<OxyColor>
{
ColorPosition,
ColorVelocity,
ColorAcceleration
},
LegendOrientation = LegendOrientation.Vertical,
LegendPlacement = LegendPlacement.Inside,
LegendPosition = LegendPosition.TopRight,
LegendBackground = OxyColor.FromAColor(200, OxyColors.White),
LegendBorder = OxyColors.Black,
PlotType = PlotType.XY
};
// YAxes
_axisPosition = new LinearAxis
{
AxislineColor = ColorPosition,
TicklineColor = ColorPosition,
TextColor = ColorPosition,
AxisTickToLabelDistance = 0,
Position = AxisPosition.Left,
Key = "position"
};
Plot.Axes.Add(_axisPosition);
_seriesPosition = new LineSeries
{
Title = (string)converter.Convert(new object[] {"", "MotionProfilePosition"}, null, null, CultureInfo.CurrentCulture) + " [" + UnitItemPosition.ToString() + "]",
YAxisKey = "position"
};
Plot.Series.Add(_seriesPosition);
_axisVelocity = new LinearAxis
{
AxislineColor = ColorVelocity,
TicklineColor = ColorVelocity,
AxisTickToLabelDistance = 0,
Position = AxisPosition.Left,
TextColor = ColorVelocity,
Key = "velocity"
};
Plot.Axes.Add(_axisVelocity);
_seriesVelocity = new LineSeries
{
Title = (string)converter.Convert(new object[] {"", "MotionProfileVelocity"}, null, null, CultureInfo.CurrentCulture) + " [" + UnitItemVelocity.ToString() + "]",
YAxisKey = "velocity"
};
Plot.Series.Add(_seriesVelocity);
_axisAcceleration = new LinearAxis
{
AxislineColor = ColorAcceleration,
TextColor = ColorAcceleration,
AxisTickToLabelDistance = 0,
Position = AxisPosition.Left,
Key = "acceleration"
};
Plot.Axes.Add(_axisAcceleration);
_seriesAcceleration = new LineSeries
{
Title = (string)converter.Convert(new object[] {"", "MotionProfileAcceleration"}, null, null, CultureInfo.CurrentCulture) + " [" + UnitItemAcceleration.ToString() + "]",
YAxisKey = "acceleration"
};
Plot.Series.Add(_seriesAcceleration);
// XAxis
_axisTime = new LinearAxis
{
Position = AxisPosition.Bottom,
Key = "time",
Unit = UnitItemTime
};
Plot.Axes.Add(_axisTime);
XAML:
<oxy:PlotView Grid.Row="0" Margin="0,0,0,15" Model="{Binding Plot, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" Tag="{Binding Path=DataContext, ElementName=MotionControlMain}" Controller="{Binding Controller, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" >
<oxy:PlotView.ContextMenu>
<ContextMenu DataContext="{Binding PlacementTarget.Tag, RelativeSource={RelativeSource Self}}">
<MenuItem IsCheckable="True" Command="{Binding UpdatePlotCommand}"
IsChecked="{Binding DisplayPosition}"
Foreground="{Binding ColorPosition, Converter={StaticResource OxyColorConverter}}">
<MenuItem.Header>
<MultiBinding Converter="{StaticResource LangConverter}">
<Binding Path="SelectedLanguage" Mode="OneWay"/>
<Binding>
<Binding.Source>MotionProfileMItemPos</Binding.Source>
</Binding>
</MultiBinding>
</MenuItem.Header>
</MenuItem>
<MenuItem IsCheckable="True" Command="{Binding UpdatePlotCommand}"
IsChecked="{Binding DisplayVelocity}"
Foreground="{Binding ColorVelocity, Converter={StaticResource OxyColorConverter}}">
<MenuItem.Header>
<MultiBinding Converter="{StaticResource LangConverter}">
<Binding Path="SelectedLanguage" Mode="OneWay"/>
<Binding>
<Binding.Source>MotionProfileMItemVelo</Binding.Source>
</Binding>
</MultiBinding>
</MenuItem.Header>
</MenuItem>
<MenuItem IsCheckable="True" Command="{Binding UpdatePlotCommand}"
IsChecked="{Binding DisplayAcceleration}"
Foreground="{Binding ColorAcceleration, Converter={StaticResource OxyColorConverter}}">
<MenuItem.Header>
<MultiBinding Converter="{StaticResource LangConverter}">
<Binding Path="SelectedLanguage" Mode="OneWay"/>
<Binding>
<Binding.Source>MotionProfileMItemAccel</Binding.Source>
</Binding>
</MultiBinding>
</MenuItem.Header>
</MenuItem>
<MenuItem IsCheckable="True" Command="{Binding UpdatePlotCommand}"
IsChecked="{Binding DisplayJerk}"
Foreground="{Binding ColorJerk, Converter={StaticResource OxyColorConverter}}">
<Separator/>
<MenuItem Command="{Binding ResetPlotCommand}">
<MenuItem.Header>
<MultiBinding Converter="{StaticResource LangConverter}">
<Binding Path="SelectedLanguage" Mode="OneWay"/>
<Binding>
<Binding.Source>MotionProfileMItemReset</Binding.Source>
</Binding>
</MultiBinding>
</MenuItem.Header>
</MenuItem>
</ContextMenu>
</oxy:PlotView.ContextMenu>
</oxy:PlotView>
作为用户,您可以 select 从给定的 3 个轴中选择您想要查看的轴。 对于更高的 TickLabelValues >1000,当值到达下一个 Y 轴时很难读取。
Screenshot Plotmodel
PositionTier 是您正在寻找的属性。这是我用来创建该图像的代码:
PlotModel = new PlotModel();
PlotModel.Axes.Add(new LinearAxis
{
Position = AxisPosition.Left,
Title = "First",
Minimum = 0,
Maximum = 10000
}) ;
PlotModel.Axes.Add(new LinearAxis
{
Position = AxisPosition.Left,
Title = "Second",
Minimum = 0,
Maximum = 10000,
PositionTier = 1
});
PlotModel.Axes.Add(new LinearAxis
{
Position = AxisPosition.Left,
Title = "Third",
Minimum = 0,
Maximum = 10000,
PositionTier = 2
});
PlotModel.Axes.Add(new LinearAxis
{
Position = AxisPosition.Bottom,
Title = "x"
});