private static IEnumerable <Model> CreateModels() { for (var i = 0; i < 3; i++) { var pm = new PlotModel { Title = string.Format("Plot {0}", i + 1) }; var series = new LineSeries(); for (var j = 0; j < 10; j++) { series.Points.Add(new DataPoint(j, r.NextDouble())); } pm.Series.Add(series); var pc = new PlotController(); pc.UnbindAll(); pc.BindKeyDown(OxyKey.Left, PlotCommands.PanRight); pc.BindKeyDown(OxyKey.Right, PlotCommands.PanLeft); yield return(new Model { PlotModel = pm, PlotController = pc }); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { spark = (SparkWindow)this.Owner; if (graphSetting == null) { graphSetting = spark.settingCommon.graphSetting; } DirectoryInfo folder = new DirectoryInfo(Core.Work.EnvPath); FileInfo[] files = folder.GetFiles("*.sqlite"); string[] filesName = new string[files.Length]; for (int i = 0; i < files.Length; i++) { filesName[i] = Path.GetFileNameWithoutExtension(files[i].FullName); } lbDataBases.ItemsSource = filesName; timerEmul.Elapsed += TimerEmul_Elapsed; var controller = new PlotController(); controller.UnbindAll(); controller.BindMouseDown(OxyMouseButton.Left, PlotCommands.PanAt); controller.BindMouseDown(OxyMouseButton.Left, OxyModifierKeys.Control, PlotCommands.ZoomRectangle); controller.BindMouseDown(OxyMouseButton.Left, OxyModifierKeys.Alt, PlotCommands.PointsOnlyTrack); controller.BindMouseWheel(PlotCommands.ZoomWheel); controller.BindKeyDown(OxyKey.R, PlotCommands.Reset); plotter.Controller = controller; }
public void UnbindAll() { var c = new PlotController(); c.UnbindAll(); Assert.AreEqual(0, c.InputCommandBindings.Count); }
public static PlotController CreateController() { var controller = new PlotController(); controller.UnbindAll(); controller.BindMouseDown(OxyMouseButton.Left, PlotCommands.PanAt); return(controller); }
private void BindCommandToPlotViews() { controller.UnbindAll(); controller.BindMouseDown(OxyMouseButton.Left, PlotCommands.Track); foreCastPlotView.Controller = controller; reviewPlotView.Controller = controller; cardTypePlotView.Controller = controller; }
public static Example LargeDataSetNarrow() { var pm = new PlotModel { Title = "Large Data Set (narrow window)" }; var timeSpanAxis1 = new DateTimeAxis { Position = AxisPosition.Bottom }; pm.Axes.Add(timeSpanAxis1); var linearAxis1 = new LinearAxis { Position = AxisPosition.Left }; pm.Axes.Add(linearAxis1); var series = new CandleStickSeries { Color = OxyColors.Black, IncreasingColor = OxyColors.DarkGreen, DecreasingColor = OxyColors.Red, DataFieldX = "Time", DataFieldHigh = "H", DataFieldLow = "L", DataFieldOpen = "O", DataFieldClose = "C", TrackerFormatString = "High: {2:0.00}\nLow: {3:0.00}\nOpen: {4:0.00}\nClose: {5:0.00}", }; var n = 1000000; foreach (var bar in HighLowItemGenerator.MRProcess(n)) { series.Append(bar); } timeSpanAxis1.Minimum = series.Items[0].X; timeSpanAxis1.Maximum = series.Items[29].X; linearAxis1.Minimum = series.Items.Take(30).Select(x => x.Low).Min(); linearAxis1.Maximum = series.Items.Take(30).Select(x => x.High).Max(); pm.Series.Add(series); timeSpanAxis1.AxisChanged += (sender, e) => AdjustYExtent(series, timeSpanAxis1, linearAxis1); var controller = new PlotController(); controller.UnbindAll(); controller.BindMouseDown(OxyMouseButton.Left, PlotCommands.PanAt); return(new Example(pm, controller)); }
private void InitGraph() { Model = new PlotModel(); DateTimeAxis axisX = new DateTimeAxis() { Title = "Время", Position = AxisPosition.Bottom, StringFormat = "HH:mm:ss", }; axisX.MajorGridlineStyle = LineStyle.Solid; axisX.MajorGridlineThickness = 1; Model.Axes.Add(axisX); int pos = 0; foreach (DataParam param in DataParams) { LinearAxis axisY = new LinearAxis() { Title = param.Title + ", " + param.ParamUnit.Title, Key = param.Title, Position = AxisPosition.Left, PositionTier = pos++ }; if (pos == 1) { axisY.AxisChanged += AxeY_AxisChanged; axisY.MajorGridlineStyle = LineStyle.Solid; axisY.MajorGridlineThickness = 1; } Model.Axes.Add(axisY); LineSeries series = new LineSeries() { Title = param.Title, YAxisKey = param.Title }; Model.Series.Add(series); } var controller = new PlotController(); controller.UnbindAll(); controller.BindMouseDown(OxyMouseButton.Left, PlotCommands.PanAt); controller.BindMouseDown(OxyMouseButton.Left, OxyModifierKeys.Control, PlotCommands.ZoomRectangle); controller.BindMouseDown(OxyMouseButton.Left, OxyModifierKeys.Alt, PlotCommands.PointsOnlyTrack); controller.BindMouseWheel(PlotCommands.ZoomWheel); controller.BindKeyDown(OxyKey.R, PlotCommands.Reset); plotter.Controller = controller; plotter.Model = Model; }
private void Window_Loaded(object sender, RoutedEventArgs e) { GS_SPA = (GS_SPAvWindow)this.Owner; WorkInfo[] listWork = GS_SPA.Core.Archive.GetListWorks(); lvArchives.ItemsSource = listWork; controller.UnbindAll(); controller.BindMouseDown(OxyMouseButton.Right, PlotCommands.PanAt); controller.BindMouseWheel(PlotCommands.ZoomWheel); controller.BindKeyDown(OxyKey.R, PlotCommands.Reset); controller.BindMouseDown(OxyMouseButton.Left, new DelegatePlotCommand <OxyMouseDownEventArgs>( (view, controller, args) => controller.AddMouseManipulator(view, new WpbTrackerManipulator(view), args))); plotter.Controller = controller; }
public ShellViewModel() { var model = new PlotModel { Title = "Example Tracker" }; var points = new List <DataPoint> { new DataPoint(0, 4), new DataPoint(10, 13), new DataPoint(20, 15), new DataPoint(30, 16), new DataPoint(40, 12), new DataPoint(50, 12) }; var seriesVisible = new OxyPlot.Series.LineSeries { Color = OxyColors.Blue, MarkerFill = OxyColors.Red, ItemsSource = points, TrackerFormatString = "X={2},\nY={4}", MarkerType = MarkerType.Circle, MarkerSize = 5 }; model.Axes.Add(new OxyPlot.Axes.LinearAxis { Position = OxyPlot.Axes.AxisPosition.Bottom }); model.Axes.Add(new OxyPlot.Axes.LinearAxis { Position = OxyPlot.Axes.AxisPosition.Left }); model.Series.Add(seriesVisible); MyModel = model; var customController = new PlotController(); customController.UnbindAll(); customController.BindMouseDown(OxyMouseButton.Left, new DelegatePlotCommand <OxyMouseDownEventArgs>((view, controller, args) => controller.AddMouseManipulator(view, new StaysOpenTrackerManipulator(view), args))); CustomPlotController = customController; MyModel.InvalidatePlot(true); }
public static Example BasicExample() { var model = new PlotModel { Title = "Basic Controller example", Subtitle = "Panning with left mouse button" }; model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom }); model.Axes.Add(new LinearAxis { Position = AxisPosition.Left }); var controller = new PlotController(); controller.UnbindAll(); controller.BindMouseDown(OxyMouseButton.Left, PlotCommands.PanAt); return(new Example(model, controller)); }
public static Example SmallDataSet() { var pm = new PlotModel { Title = "Small Data Set" }; var timeSpanAxis1 = new DateTimeAxis { Position = AxisPosition.Bottom }; pm.Axes.Add(timeSpanAxis1); var linearAxis1 = new LinearAxis { Position = AxisPosition.Left }; pm.Axes.Add(linearAxis1); var n = 100; var items = HighLowItemGenerator.MRProcess(n).ToArray(); var series = new CandleStickSeries { Color = OxyColors.Black, IncreasingColor = OxyColors.DarkGreen, DecreasingColor = OxyColors.Red, DataFieldX = "X", DataFieldHigh = "High", DataFieldLow = "Low", DataFieldOpen = "Open", DataFieldClose = "Close", TrackerFormatString = "High: {2:0.00}\nLow: {3:0.00}\nOpen: {4:0.00}\nClose: {5:0.00}", ItemsSource = items }; pm.Series.Add(series); timeSpanAxis1.AxisChanged += (sender, e) => AdjustYExtent(series, timeSpanAxis1, linearAxis1); var controller = new PlotController(); controller.UnbindAll(); controller.BindMouseDown(OxyMouseButton.Left, PlotCommands.PanAt); return(new Example(pm, controller)); }
public ShellViewModel() { var model = new PlotModel { Title = "Example Tracker" }; var points = new List <CustomDataPoint> { new CustomDataPoint(0, 4, "point 1"), new CustomDataPoint(10, 13, "point 2"), new CustomDataPoint(20, 15, "point 3"), new CustomDataPoint(30, 16, "point 4"), new CustomDataPoint(40, 12, "point 5"), new CustomDataPoint(50, 12, "point 6") }; var seriesVisible = new OxyPlot.Series.LineSeries { Color = OxyColors.Blue, MarkerFill = OxyColors.Red, ItemsSource = points, TrackerFormatString = "X={2},\nY={4},\nAdditionalInfo={Description}", MarkerType = MarkerType.Circle, MarkerSize = 5 }; model.Axes.Add(new OxyPlot.Axes.LinearAxis { Position = Axes.AxisPosition.Bottom }); model.Axes.Add(new OxyPlot.Axes.LinearAxis { Position = Axes.AxisPosition.Left }); model.Series.Add(seriesVisible); MyModel = model; CustomPlotController = new PlotController(); CustomPlotController.UnbindAll(); CustomPlotController.BindTouchDown(PlotCommands.PointsOnlyTrackTouch); MyModel.InvalidatePlot(true); }
public void InitGraph() { Model = new PlotModel(); Model.LegendPosition = LegendPosition.RightBottom; DateTimeAxis axisX = new DateTimeAxis() { Title = "Время", Position = AxisPosition.Bottom, StringFormat = "HH:mm:ss" }; axisX.Minimum = DateTimeAxis.ToDouble(DateTime.Now); axisX.MajorGridlineStyle = LineStyle.Solid; axisX.MajorGridlineThickness = 1; Model.Axes.Add(axisX); bool first = true; int indexTier = 0; foreach (DataParam param in DataParams) { bool addAxe = true; /*foreach (LinearAxis axe in Model.Axes) { * if (axe.Title == param.Title.Split(',')[1]) { * addAxe = false; * } * }*/ if (addAxe) { LinearAxis axeY = new LinearAxis() { //Title = param.Title.Split(' ')[0] + ", " + param.Title.Split(',')[1], Key = param.Title.Split(',')[0], Position = AxisPosition.Left, PositionTier = indexTier++, TextColor = OxyColor.FromRgb(param.ColorLine.Color.R, param.ColorLine.Color.G, param.ColorLine.Color.B), AxislineColor = OxyColor.FromRgb(param.ColorLine.Color.R, param.ColorLine.Color.G, param.ColorLine.Color.B), AxislineStyle = LineStyle.Solid }; if (first) { first = false; //axeY.AxisChanged += AxeY_AxisChanged; axeY.MajorGridlineStyle = LineStyle.Solid; axeY.MajorGridlineThickness = 1; } Model.Axes.Add(axeY); } LineSeries series = new LineSeries() { Title = param.Title, YAxisKey = param.Title.Split(',')[0], Color = OxyColor.FromRgb(param.ColorLine.Color.R, param.ColorLine.Color.G, param.ColorLine.Color.B) }; //series.InterpolationAlgorithm = InterpolationAlgorithms.CanonicalSpline; Model.Series.Add(series); } for (; indexTier < 4;) { LinearAxis axeY = new LinearAxis() { //Title = param.Title.Split(' ')[0] + ", " + param.Title.Split(',')[1], Position = AxisPosition.Left, PositionTier = indexTier++, TextColor = OxyColors.White, AxislineColor = OxyColors.White, TitleColor = OxyColors.White, TicklineColor = OxyColors.White, }; Model.Axes.Add(axeY); } var controller = new PlotController(); controller.UnbindAll(); plotter.Controller = controller; plotter.Model = Model; plotter.Model.PlotMargins = new OxyThickness(150, double.NaN, double.NaN, double.NaN); }
/// <summary> /// Creates the candle stick and volume series example. /// </summary> /// <returns>The candle stick and volume series example.</returns> /// <param name="title">Title.</param> /// <param name="style">Style.</param> /// <param name="n">N.</param> /// <param name="naturalY">If set to <c>true</c> natural y.</param> /// <param name="naturalV">If set to <c>true</c> natural v.</param> private static Example CreateCandleStickAndVolumeSeriesExample( string title, VolumeStyle style, int n = 10000, bool naturalY = false, bool naturalV = false) { var pm = new PlotModel { Title = title }; var series = new CandleStickAndVolumeSeries { PositiveColor = OxyColors.DarkGreen, NegativeColor = OxyColors.Red, PositiveHollow = false, NegativeHollow = false, SeparatorColor = OxyColors.Gray, SeparatorLineStyle = LineStyle.Dash, VolumeStyle = style }; // create bars foreach (var bar in OhlcvItemGenerator.MRProcess(n)) { series.Append(bar); } // create visible window var Istart = n - 200; var Iend = n - 120; var Ymin = series.Items.Skip(Istart).Take(Iend - Istart + 1).Select(x => x.Low).Min(); var Ymax = series.Items.Skip(Istart).Take(Iend - Istart + 1).Select(x => x.High).Max(); var Xmin = series.Items[Istart].X; var Xmax = series.Items[Iend].X; // setup axes var timeAxis = new DateTimeAxis { Position = AxisPosition.Bottom, Minimum = Xmin, Maximum = Xmax }; var barAxis = new LinearAxis { Position = AxisPosition.Left, Key = series.BarAxisKey, StartPosition = 0.25, EndPosition = 1.0, Minimum = naturalY ? double.NaN : Ymin, Maximum = naturalY ? double.NaN : Ymax }; var volAxis = new LinearAxis { Position = AxisPosition.Left, Key = series.VolumeAxisKey, StartPosition = 0.0, EndPosition = 0.22, Minimum = naturalV ? double.NaN : 0, Maximum = naturalV ? double.NaN : 5000 }; switch (style) { case VolumeStyle.None: barAxis.Key = null; barAxis.StartPosition = 0.0; pm.Axes.Add(timeAxis); pm.Axes.Add(barAxis); break; case VolumeStyle.Combined: case VolumeStyle.Stacked: pm.Axes.Add(timeAxis); pm.Axes.Add(barAxis); pm.Axes.Add(volAxis); break; case VolumeStyle.PositiveNegative: volAxis.Minimum = naturalV ? double.NaN : -5000; pm.Axes.Add(timeAxis); pm.Axes.Add(barAxis); pm.Axes.Add(volAxis); break; } pm.Series.Add(series); if (naturalY == false) { timeAxis.AxisChanged += (sender, e) => AdjustYExtent(series, timeAxis, barAxis); } var controller = new PlotController(); controller.UnbindAll(); controller.BindMouseDown(OxyMouseButton.Left, PlotCommands.PanAt); return(new Example(pm, controller)); }
public DashletGenerator() { displayCapacity = new PlotModel { Title = "Total Capacity" }; PieSeries ps = new PieSeries { StrokeThickness = 2.0, InsideLabelPosition = .5, AngleSpan = 360, StartAngle = 0 }; ps.Slices.Add(new PieSlice("Allocated", 2515.64)); ps.Slices.Add(new PieSlice("Free", 4132.20)); displayCapacity.Series.Add(ps); displaySystemsByRegion = new PlotModel { Title = "Systems By Region" }; BarSeries bs = new BarSeries { StrokeColor = OxyColors.Black, StrokeThickness = 1 }; bs.Items.Add(new BarItem { Value = 16 }); bs.Items.Add(new BarItem { Value = 11 }); bs.Items.Add(new BarItem { Value = 8 }); bs.Items.Add(new BarItem { Value = 2 }); CategoryAxis ca = new CategoryAxis { Position = AxisPosition.Left }; ca.Labels.Add("Americas"); ca.Labels.Add("EMEA"); ca.Labels.Add("AMS"); ca.Labels.Add("APJ"); LinearAxis va = new LinearAxis { Position = AxisPosition.Bottom, AbsoluteMinimum = 0 }; displaySystemsByRegion.Series.Add(bs); displaySystemsByRegion.Axes.Add(ca); displaySystemsByRegion.Axes.Add(va); controllerSystemsByRegion = new PlotController(); controllerSystemsByRegion.UnbindAll(); displaySystemsByFeature = new PlotModel { Title = "Systems By Feature" }; PieSeries ps2 = new PieSeries { StrokeThickness = 2.0, InsideLabelPosition = .5, AngleSpan = 360, StartAngle = 0 }; ps2.Slices.Add(new PieSlice("CAT", 29)); ps2.Slices.Add(new PieSlice("NAS", 28)); ps2.Slices.Add(new PieSlice("VTL", 29)); displaySystemsByFeature.Series.Add(ps2); }
public DebugParametersTrendViewModel() { PlotVm = new PlotModel { IsLegendVisible = false }; PlotVm.Axes.Add(new DateTimeAxis()); PlotVm.Axes.Add(new LinearAxis()); //_plotVm.Series.Add(new FunctionSeries(Math.Cos, 0, 10, 0.1, "cos(x)")); PlotCr = new PlotController(); PlotCr.UnbindAll(); PlotCr.BindMouseDown(OxyMouseButton.Left, PlotCommands.Track); PlotCr.Bind(new OxyMouseDownGesture(OxyMouseButton.Right), PlotCommands.PanAt); PlotCr.Bind(new OxyMouseDownGesture(OxyMouseButton.Left), PlotCommands.ZoomRectangle); PlotCr.Bind(new OxyMouseEnterGesture(), PlotCommands.HoverPointsOnlyTrack); PlotCr.BindMouseWheel(PlotCommands.ZoomWheel); PlotCr.BindMouseDown(OxyMouseButton.Left, OxyModifierKeys.None, 2, PlotCommands.ResetAt); _points1 = new LineSeries { Color = OxyColor.FromRgb(255, 0, 0) }; _points2 = new LineSeries { Color = OxyColor.FromRgb(0, 128, 0) }; _points3 = new LineSeries { Color = OxyColor.FromRgb(0, 0, 128) }; _points4 = new LineSeries { Color = OxyColor.FromRgb(128, 0, 128) }; PlotVm.Series.Add(_points1); PlotVm.Series.Add(_points2); PlotVm.Series.Add(_points3); PlotVm.Series.Add(_points4); TrendControlVm1 = new TrendControlViewModel("Параметр 1", this); TrendControlVm2 = new TrendControlViewModel("Параметр 2", this); TrendControlVm3 = new TrendControlViewModel("Параметр 3", this); TrendControlVm4 = new TrendControlViewModel("Параметр 4", this); CommandPanLeftFast = new RelayCommand(() => { PlotVm.PanAllAxes(PlotVm.PlotArea.Width / 4.0, 0); PlotVm.InvalidatePlot(false); }); CommandPanLeft = new RelayCommand(() => { PlotVm.PanAllAxes(PlotVm.PlotArea.Width / 20.0, 0); PlotVm.InvalidatePlot(false); }); CommandPanRight = new RelayCommand(() => { PlotVm.PanAllAxes(PlotVm.PlotArea.Width / -20.0, 0); PlotVm.InvalidatePlot(false); }); CommandPanRightFast = new RelayCommand(() => { PlotVm.PanAllAxes(PlotVm.PlotArea.Width / -4.0, 0); PlotVm.InvalidatePlot(false); }); CommandZoomOut = new RelayCommand(() => { PlotVm.ZoomAllAxes(0.8); PlotVm.InvalidatePlot(false); }); CommandZoomIn = new RelayCommand(() => { PlotVm.ZoomAllAxes(1.25); PlotVm.InvalidatePlot(false); }); CommandZoomAll = new RelayCommand(() => { PlotVm.ResetAllAxes(); PlotVm.InvalidatePlot(false); }); CommandPanUpFast = new RelayCommand(() => { PlotVm.PanAllAxes(0, PlotVm.PlotArea.Height / 4.0); PlotVm.InvalidatePlot(false); }); CommandPanUp = new RelayCommand(() => { PlotVm.PanAllAxes(0, PlotVm.PlotArea.Height / 20.0); PlotVm.InvalidatePlot(false); }); CommandPanDown = new RelayCommand(() => { PlotVm.PanAllAxes(0, PlotVm.PlotArea.Height / -20.0); PlotVm.InvalidatePlot(false); }); CommandPanDownFast = new RelayCommand(() => { PlotVm.PanAllAxes(0, PlotVm.PlotArea.Height / -4.0); PlotVm.InvalidatePlot(false); }); }
public DashletGenerator(string companyName) { List <Unit> items = new List <Unit>(); HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(new Uri("http://54.173.140.216:8080")); var postData = "query=SELECT `capacity.total.freeTiB`, systemName, serialNumber, `location.region`, `capacity.total.sizeTiB` FROM msa.data WHERE companyName = '" + companyName + "'"; var data = Encoding.ASCII.GetBytes(postData); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = data.Length; using (var stream = request.GetRequestStream()) { stream.Write(data, 0, data.Length); } var response = (HttpWebResponse)request.GetResponse(); var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd(); List <String> raw_data = new List <String>(); Regex rgx = new Regex(@"\[.*?\]"); Regex rgx2 = new Regex("[^a-zA-Z0-9\\.\\(\\)\\-\\:\\, -]"); string temp = ""; foreach (Match match in rgx.Matches(responseString)) { temp = rgx2.Replace(match.Value, ""); raw_data.Add(temp); } var mach_to_region = new System.Collections.Generic.Dictionary <string, string>(); var region_to_count = new System.Collections.Generic.Dictionary <string, int>(); var region_set = new System.Collections.Generic.HashSet <string>(); var region_list = new List <string>(); for (int i = 0; i < raw_data.Count; i++) { string[] unitInfo = raw_data[i].Split(','); items.Add(new Unit() { capacity = unitInfo[0], systemName = unitInfo[1], serialNumber = unitInfo[2], region = unitInfo[3], total_cap = unitInfo[4] }); region_list.Add((unitInfo[3])); region_set.Add(unitInfo[3]); mach_to_region[unitInfo[1]] = unitInfo[3]; } displayCapacity = new PlotModel { Title = "Total Capacity" }; float avg_allocated = 0; float avg_free = 0; for (int i = 0; i < items.Count; i++) { avg_allocated += (float.Parse(items[i].total_cap) - float.Parse(items[i].capacity)); avg_free += float.Parse(items[i].capacity); } avg_allocated /= items.Count(); avg_free /= items.Count(); PieSeries ps = new PieSeries { StrokeThickness = 2.0, InsideLabelPosition = .5, AngleSpan = 360, StartAngle = 0 }; ps.Slices.Add(new PieSlice("Allocated", avg_allocated)); ps.Slices.Add(new PieSlice("Free", avg_free)); displayCapacity.Series.Add(ps); displaySystemsByRegion = new PlotModel { Title = "Systems By Region" }; //postData = "query=SELECT `location.region`, systemName, serialNumber FROM msa.data WHERE companyName = '" + companyName + "'"; //data = Encoding.ASCII.GetBytes(postData); //request.Method = "POST"; //request.ContentType = "application/x-www-form-urlencoded"; //request.ContentLength = data.Length; //using (var stream = request.GetRequestStream()) //{ // stream.Write(data, 0, data.Length); //} //response = (HttpWebResponse)request.GetResponse(); //responseString = new StreamReader(response.GetResponseStream()).ReadToEnd(); //raw_data = new List<String>(); //rgx = new Regex(@"\[.*?\]"); //rgx2 = new Regex("[^a-zA-Z0-9\\.\\(\\)\\-\\:\\, -]"); //temp = ""; //foreach (Match match in rgx.Matches(responseString)) //{ // temp = rgx2.Replace(match.Value, ""); // raw_data.Add(temp); //} //for (int i = 0; i < raw_data.Count; i++) //{ // string[] unitInfo = raw_data[i].Split(','); // items.Add(new Unit() // { // region = unitInfo[0], // systemName = unitInfo[1], // serialNumber = unitInfo[2] // }); //} BarSeries bs = new BarSeries { StrokeColor = OxyColors.Black, StrokeThickness = 1 }; CategoryAxis ca = new CategoryAxis { Position = AxisPosition.Left }; if (region_set.Count() > 1) { foreach (string region in region_list) { region_to_count[region] += 1; } foreach (string reg in region_to_count.Keys) { bs.Items.Add(new BarItem { Value = region_to_count[reg] }); ca.Labels.Add(reg); } } else { bs.Items.Add(new BarItem { Value = 16 }); bs.Items.Add(new BarItem { Value = 11 }); bs.Items.Add(new BarItem { Value = 8 }); bs.Items.Add(new BarItem { Value = 2 }); ca.Labels.Add("Americas"); ca.Labels.Add("EMEA"); ca.Labels.Add("AMS"); ca.Labels.Add("APJ"); } LinearAxis va = new LinearAxis { Position = AxisPosition.Bottom, AbsoluteMinimum = 0 }; displaySystemsByRegion.Series.Add(bs); displaySystemsByRegion.Axes.Add(ca); displaySystemsByRegion.Axes.Add(va); controllerSystemsByRegion = new PlotController(); controllerSystemsByRegion.UnbindAll(); displaySystemsByFeature = new PlotModel { Title = "Systems By Feature" }; PieSeries ps2 = new PieSeries { StrokeThickness = 2.0, InsideLabelPosition = .5, AngleSpan = 360, StartAngle = 0 }; ps2.Slices.Add(new PieSlice("CAT", 29)); ps2.Slices.Add(new PieSlice("NAS", 28)); ps2.Slices.Add(new PieSlice("VTL", 29)); displaySystemsByFeature.Series.Add(ps2); }
/// <summary> /// Creates the volume series. /// </summary> /// <returns>The volume series.</returns> /// <param name="title">Title.</param> /// <param name="style">Style.</param> /// <param name="n">N.</param> /// <param name="natural">If set to <c>true</c> natural.</param> /// <param name="transposed">If set to <c>true</c> transposed.</param> private static Example CreateVolumeSeries( string title, VolumeStyle style, int n = 10000, bool natural = false) { var pm = new PlotModel { Title = title }; var series = new VolumeSeries { PositiveColor = OxyColors.DarkGreen, NegativeColor = OxyColors.Red, PositiveHollow = false, NegativeHollow = false, VolumeStyle = style, Title = "VolumeSeries", }; // create bars foreach (var bar in OhlcvItemGenerator.MRProcess(n)) { series.Append(bar); } // create visible window var Istart = n - 200; var Iend = n - 120; var Xmin = series.Items[Istart].X; var Xmax = series.Items[Iend].X; // setup axes var timeAxis = new DateTimeAxis { Position = AxisPosition.Bottom, Minimum = Xmin, Maximum = Xmax }; var volAxis = new LinearAxis { Position = AxisPosition.Left, StartPosition = 0.0, EndPosition = 1.0, Minimum = natural ? double.NaN : 0, Maximum = natural ? double.NaN : 10000 }; switch (style) { case VolumeStyle.Combined: case VolumeStyle.Stacked: pm.Axes.Add(timeAxis); pm.Axes.Add(volAxis); break; case VolumeStyle.PositiveNegative: volAxis.Minimum = natural ? double.NaN : -10000; pm.Axes.Add(timeAxis); pm.Axes.Add(volAxis); break; } pm.Series.Add(series); var controller = new PlotController(); controller.UnbindAll(); controller.BindMouseDown(OxyMouseButton.Left, PlotCommands.PanAt); return(new Example(pm, controller)); }