Created
June 22, 2017 02:25
-
-
Save peace2048/1d7577187507d252bcc6e08658ebbffb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Query Kind="Statements"> | |
<Reference><RuntimeDirectory>\System.Windows.Forms.dll</Reference> | |
<NuGetReference>OxyPlot.WindowsForms</NuGetReference> | |
<Namespace>OxyPlot</Namespace> | |
<Namespace>OxyPlot.Axes</Namespace> | |
<Namespace>OxyPlot.Series</Namespace> | |
</Query> | |
var pm = new PlotModel | |
{ | |
IsLegendVisible = true, | |
LegendPlacement = LegendPlacement.Outside, | |
LegendPosition = LegendPosition.LeftTop | |
}; | |
var xaxis = new DateTimeAxis | |
{ | |
Position = AxisPosition.Bottom, | |
StringFormat = "h:mm" | |
}; | |
pm.Axes.Add(xaxis); | |
var yaxis = new LinearAxis | |
{ | |
IsAxisVisible = false, | |
IsPanEnabled = false, | |
IsZoomEnabled = false | |
}; | |
pm.Axes.Add(yaxis); | |
var gannt1 = new RectangleBarSeries(); | |
gannt1.Title = "AAA"; | |
gannt1.Items.Add(new RectangleBarItem( | |
DateTimeAxis.ToDouble(DateTime.Today.Add(new TimeSpan(8, 30, 0))), 0, | |
DateTimeAxis.ToDouble(DateTime.Today.Add(new TimeSpan(8, 32, 0))), 1) | |
); | |
gannt1.Items.Add(new RectangleBarItem( | |
DateTimeAxis.ToDouble(DateTime.Today.Add(new TimeSpan(8, 35, 0))), 0, | |
DateTimeAxis.ToDouble(DateTime.Today.Add(new TimeSpan(8, 37, 0))), 1) | |
); | |
gannt1.Items.Add(new RectangleBarItem( | |
DateTimeAxis.ToDouble(DateTime.Today.Add(new TimeSpan(8, 43, 0))), 0, | |
DateTimeAxis.ToDouble(DateTime.Today.Add(new TimeSpan(8, 44, 0))), 1) | |
); | |
pm.Series.Add(gannt1); | |
var gannt2 = new RectangleBarSeries(); | |
gannt2.Title = "BBB"; | |
gannt2.Items.Add(new RectangleBarItem( | |
DateTimeAxis.ToDouble(DateTime.Today.Add(new TimeSpan(8, 31, 0))), 1, | |
DateTimeAxis.ToDouble(DateTime.Today.Add(new TimeSpan(8, 33, 0))), 2) | |
); | |
gannt2.Items.Add(new RectangleBarItem( | |
DateTimeAxis.ToDouble(DateTime.Today.Add(new TimeSpan(8, 35, 0))), 1, | |
DateTimeAxis.ToDouble(DateTime.Today.Add(new TimeSpan(8, 40, 0))), 2) | |
); | |
gannt2.Items.Add(new RectangleBarItem( | |
DateTimeAxis.ToDouble(DateTime.Today.Add(new TimeSpan(8, 41, 0))), 1, | |
DateTimeAxis.ToDouble(DateTime.Today.Add(new TimeSpan(8, 50, 0))), 2) | |
); | |
pm.Series.Add(gannt2); | |
new OxyPlot.WindowsForms.PlotView { Model = pm }.Dump(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment