下午好,现在我有这张图表,但我想在条形图中添加红色和蓝色线条。我与oxyplot相当新。谢谢你的帮助。
我目前正在使用保存为布尔值的继电器中的事件显示。因此,最好有一条水平线参考。
蓝线只是代表系统中事件的另一条线。
这是我的xaml
<Window x:Class="Label_Issue.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Label_Issue"
xmlns:oxy="http://oxyplot.org/wpf"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Grid>
<oxy:PlotView x:Name="barChartModel"/>
</Grid>
Run Code Online (Sandbox Code Playgroud)
这是我的.cs
namespace Label_Issue
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
SetUtilizationData();
}
public PlotModel PlotModel { get; set; }
private void SetUtilizationData()
{
PlotModel = new PlotModel
{
LegendOrientation = LegendOrientation.Vertical,
LegendPlacement = LegendPlacement.Outside,
LegendPosition = LegendPosition.RightTop
};
// define x-axis
OxyPlot.Axes.DateTimeAxis dateAxis = new OxyPlot.Axes.DateTimeAxis
{
Position = OxyPlot.Axes.AxisPosition.Bottom,
//StringFormat = "dd/MM/yy HH:mm" // …Run Code Online (Sandbox Code Playgroud)