double l; // reference length which is max{grid length, grid height} public MainWindow() { InitializeComponent(); this.plot.Model = new PlotModel() { PlotType = PlotType.Cartesian }; this.plotModel = this.plot.Model; this.customController = new PlotController(); this.plot.Controller = this.customController; customController.UnbindMouseDown(OxyMouseButton.Left); customController.BindMouseEnter(PlotCommands.HoverPointsOnlyTrack); plotModel.Axes.Add(new LinearAxis() { Position = AxisPosition.Bottom, //IsAxisVisible = false }); plotModel.Axes.Add(new LinearAxis() { Position = AxisPosition.Left, //IsAxisVisible = false }); }
private static PlotController CreatePlotController() { // create a new plot controller with default bindings var plotController = new PlotController(); // add a tracker command to the mouse enter event plotController.BindMouseEnter(PlotCommands.HoverPointsOnlyTrack); return(plotController); }
public ViewModel() { _data = new ModelData(); InitData(_data); //Show point legend when hovering _customPlotController = new PlotController(); _customPlotController.UnbindMouseDown(OxyMouseButton.Left); _customPlotController.BindMouseEnter(PlotCommands.HoverSnapTrack); _plotModel = new PlotModel(); // ShowPMass(); }
public DashboardViewModel(BusyIndicatorViewModel busyIndicator) { _busyIndicator = busyIndicator; RefreshPivotEvolutionCommand = new AsyncCommand(RefreshPivotEvolution, () => !_busyIndicator.IsBusy); Filter = new DashboardFilterViewModel(); Filter.FilterInvalidated += async(sender, arg) => { await Refresh(sender); }; _asyncMessageReceiver = new AsyncMessageReceiver(MessengerInstance); _asyncMessageReceiver.RegisterAsync <AccountsViewModelLoaded>(this, OnAccountsViewModelLoaded); PlotController = new PlotController(); // show tooltip on mouse over, instead of on click PlotController.UnbindMouseDown(OxyMouseButton.Left); PlotController.BindMouseEnter(PlotCommands.HoverSnapTrack); _selectionHandlers = new List <PlotModelRangeSelectionHandler>(); _pivotEvolutionMainMetric = nameof(CompareCellModel.Balance); _pivotEvolutionPeriod = RecurrenceFamily.Yearly; }
public static Example HoverTracking() { var model = new PlotModel { Title = "Show tracker without clicking" }; model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom }); model.Axes.Add(new LinearAxis { Position = AxisPosition.Left }); model.Series.Add(new FunctionSeries(t => (Math.Cos(t) * 5) + Math.Cos(t * 50), t => (Math.Sin(t) * 5) + Math.Sin(t * 50), 0, Math.PI * 2, 20000)); // create a new plot controller with default bindings var controller = new PlotController(); // add a tracker command to the mouse enter event controller.BindMouseEnter(PlotCommands.HoverPointsOnlyTrack); return(new Example(model, controller)); }
public ViewModel() { _data = new ModelData(); //Shole point legend when hovering _customPlotController = new PlotController(); _customPlotController.UnbindMouseDown(OxyMouseButton.Left); _customPlotController.BindMouseEnter(PlotCommands.HoverSnapTrack); _plotModel = new PlotModel(); _pointsDummyTemp = new PointsDummy(); _pointsDummyFriction = new PointsDummy(); //TESTING InitData(_data); PointsDummyFriction.ModelData1.FRunFriction = 0.25; PointsDummyFriction.ModelData2.FRunFriction = 0.1; PointsDummyFriction.ModelData3.FRunFriction = 0.07; PointsDummyFriction.ModelData4.FRunFriction = 0.045; PointsDummyFriction.ModelData5.FRunFriction = 0.03; PointsDummyTemp.ModelData1.P0 = 1.1455; PointsDummyTemp.ModelData2.P0 = 1.1839; PointsDummyTemp.ModelData3.P0 = 1.225; PointsDummyTemp.ModelData4.P0 = 1.269; PointsDummyTemp.ModelData5.P0 = 1.3163; }
public KiviKayra(Window kiv, List <SeulakirjastoIndex> s, List <SeulaLapPros> p, List <Seulakirjasto> alls, List <SeulaLapPros> sisAla, List <SeulaLapPros> sisYla, List <SeulaLapPros> uloAla, List <SeulaLapPros> uloYla) { InitializeComponent(); _kivi = (Kiviohjelma)kiv; seulat = s; prosentit = p; kaikkiseulat = alls; sisOhjeAla = sisAla; sisOhjeYla = sisYla; uloOhjeAla = uloAla; uloOhjeYla = uloYla; //Tällä saadaan osoitin toimimaan niin, että ei tarvitse muuta tehdä kuin laittaa hiiren osoitin koordinaattipisteen päälle //niin se näyttää koordinaattitiedot automaattisesti customController = new PlotController(); customController.UnbindMouseDown(OxyMouseButton.Left); customController.BindMouseEnter(PlotCommands.HoverSnapTrack); var model = new PlotModel { Title = "Rakeisuuskäyrä", Subtitle = "Vie hiiri pisteiden lähelle nähdäksesi arvot" }; //model.PlotType = PlotType.XY; model.LegendPosition = LegendPosition.TopRight; model.LegendOrientation = LegendOrientation.Horizontal; model.LegendPlacement = LegendPlacement.Outside; /*Collection<Item> items = new Collection<Item>(); * for (int i = kaikkiseulat.Count - 1; i >= 0; i--) * { * items.Add(new Item(kaikkiseulat[i].seula.ToString(), kaikkiseulat[i].seula)); * }*/ LinearAxis yaxis = new LinearAxis //Y-akseli { Maximum = 100, Minimum = 0, Title = "Prosentti", TickStyle = TickStyle.Inside, MinorTickSize = 4, Position = AxisPosition.Left, MinorStep = 5, MinorGridlineStyle = LineStyle.Dot, //AbsoluteMaximum = 100, //AbsoluteMinimum = 0, MajorStep = 10, //MinorStep = 5, MajorGridlineStyle = LineStyle.Dash, //MinorGridlineStyle = LineStyle.Dash, IsZoomEnabled = false, IsPanEnabled = false }; //------------------------------Logaritmiakseli------------------------- LogarithmicAxis xaxis = new LogarithmicAxis(); //X-akseli if (seulat == null || prosentit == null || seulat.Count == 0 || prosentit.Count == 0) { xaxis.Title = "Seula"; xaxis.TickStyle = TickStyle.Inside; xaxis.Position = AxisPosition.Bottom; xaxis.MajorGridlineStyle = LineStyle.Solid; //xaxis.MajorStep = 2; //xaxis.MinorGridlineStyle = LineStyle.Dash; //xaxis.Maximum = seulat[0].seula; xaxis.Minimum = 0.001; xaxis.IsZoomEnabled = false; xaxis.IsPanEnabled = false; } else { xaxis.Title = "Seula"; xaxis.TickStyle = TickStyle.Inside; xaxis.Position = AxisPosition.Bottom; xaxis.MajorGridlineStyle = LineStyle.Solid; //xaxis.Base = logbase; //xaxis.MajorStep = //xaxis.MinorGridlineStyle = LineStyle.Dash; xaxis.Maximum = kaikkiseulat[0].seula; //xaxis.Minimum = 0.001; if (kaikkiseulat[(kaikkiseulat.Count - 1)].seula > 0) { xaxis.Minimum = (kaikkiseulat[(kaikkiseulat.Count - 1)].seula); } else { xaxis.Minimum = 0.001; } xaxis.AbsoluteMinimum = 0; xaxis.IsZoomEnabled = false; xaxis.IsPanEnabled = false; xaxis.StartPosition = 0; } /*CategoryAxis caxis = new CategoryAxis();//X-akseli * * if (seulat == null || prosentit == null || seulat.Count == 0 || prosentit.Count == 0) * { * caxis.Title = "Seula"; * caxis.TickStyle = TickStyle.Inside; * caxis.Position = AxisPosition.Bottom; * caxis.IsTickCentered = true; * caxis.MajorGridlineStyle = LineStyle.Solid; * caxis.MajorGridlineColor = OxyColors.DarkSlateGray; * caxis.MajorTickSize = 7; * //caxis.Maximum = seulat[0].seula; * //caxis.Minimum = seulat[(seulat.Count - 1)].seula; * caxis.IsZoomEnabled = false; * caxis.IsPanEnabled = false; * caxis.MinorStep = 0.5; * caxis.MajorStep = 1; * caxis.ItemsSource = items; * caxis.LabelField = "Label"; * } * else * { * caxis.Title = "Seula"; * caxis.TickStyle = TickStyle.Inside; * caxis.Position = AxisPosition.Bottom; * caxis.IsTickCentered = true; * caxis.MajorGridlineStyle = LineStyle.Solid; * caxis.MajorGridlineColor = OxyColors.DarkSlateGray; * caxis.MajorTickSize = 7; * //caxis.Maximum = seulat[0].seula; * //caxis.Minimum = seulat[(seulat.Count-1)].seula; * caxis.IsZoomEnabled = false; * caxis.IsPanEnabled = false; * caxis.MinorStep = 0.5; * caxis.MajorStep = 1; * caxis.ItemsSource = items; * caxis.LabelField = "Label"; * } * for (int i = kaikkiseulat.Count-1; i >= 0; i--) //Laittaa Y-akselille otsikot, eli seulat jotka on käytössä tällä hetkellä * { * caxis.ActualLabels.Add(kaikkiseulat[i].seula.ToString()); * }*/ LineSeries l1 = new LineSeries //Tuloskäyrä/viiva { Title = "Rakeisuuskäyrä", MarkerType = MarkerType.Circle, CanTrackerInterpolatePoints = false, MarkerSize = 5 //LabelFormatString = "Läp%: {1:0.0} %" }; LineSeries ohje1 = new LineSeries { Title = "Sisäiset ohjealueet", MarkerType = MarkerType.None, CanTrackerInterpolatePoints = false, MarkerSize = 0, Color = OxyColors.CadetBlue, RenderInLegend = true }; LineSeries ohje2 = new LineSeries { //Title = "Sisäinen ylempi ohjealue", MarkerType = MarkerType.None, CanTrackerInterpolatePoints = false, MarkerSize = 0, Color = OxyColors.CadetBlue, RenderInLegend = false }; LineSeries ohje3 = new LineSeries { Title = "Ulkoiset ohjealueet", MarkerType = MarkerType.None, CanTrackerInterpolatePoints = false, MarkerSize = 0, Color = OxyColors.Indigo, RenderInLegend = true }; LineSeries ohje4 = new LineSeries { //Title = "Ulkoinen ylempi ohjealue", MarkerType = MarkerType.None, CanTrackerInterpolatePoints = false, MarkerSize = 0, Color = OxyColors.Indigo, RenderInLegend = false }; //seulat.Reverse(); /*sisOhjeAla.Reverse(); * sisOhjeYla.Reverse(); * uloOhjeAla.Reverse(); * uloOhjeYla.Reverse();*/ List <Pisteet> la = new List <Pisteet>(); //Pääviiva List <Pisteet> o1 = new List <Pisteet>(); List <Pisteet> o2 = new List <Pisteet>(); List <Pisteet> o3 = new List <Pisteet>(); List <Pisteet> o4 = new List <Pisteet>(); //------------------Käytetään CategoryAxisin kanssa-------------------- /*int j = 0; * for (int i = prosentit.Count - 1; i >= 0; i--) * { * Pisteet l = new Pisteet(); * l.X = seulat[i].index; * l.Y = prosentit[j].tulos; * la.Add(l); * j++; * }//--------------------------------------------------------------------*/ //---------------Käytetään LogarithmAxisin kanssa--------------------- for (int i = 0; i < prosentit.Count; i++) { Pisteet l = new Pisteet(); l.X = seulat[i].seula;//seulat[i].seula kun käytetään LogarithmAxisia l.Y = prosentit[i].tulos; la.Add(l); }//--------------------------------------------------------------------*/ foreach (Control c in _kivi.ohjeArvot.Children) { if (c.GetType() == typeof(TextBox)) { if (((TextBox)c).Tag.ToString() != null) { if (((TextBox)c).Tag.ToString() == "seulaValue") { if (((TextBox)c).Text != String.Empty) { string seulatxt = ((TextBox)c).Text; seulatxt = seulatxt.Replace(".", ","); string name = ((TextBox)c).Name; int ind = Convert.ToInt32(Regex.Match(name, @"\d+$").Value);//otetaan objektin järjestysnumero nimestä, foreach (SeulaLapPros sl in sisOhjeAla) { if (ind == sl.index) { if (Double.TryParse(seulatxt, out double r) == true) { sl.seulaArvo = Convert.ToDouble(seulatxt); } } } foreach (SeulaLapPros sl in sisOhjeYla) { if (ind == sl.index) { if (Double.TryParse(seulatxt, out double r) == true) { sl.seulaArvo = Convert.ToDouble(seulatxt); } } } foreach (SeulaLapPros sl in uloOhjeAla) { if (ind == sl.index) { if (Double.TryParse(seulatxt, out double r) == true) { sl.seulaArvo = Convert.ToDouble(seulatxt); } } } foreach (SeulaLapPros sl in uloOhjeYla) { if (ind == sl.index) { if (Double.TryParse(seulatxt, out double r) == true) { sl.seulaArvo = Convert.ToDouble(seulatxt); } } } } } } } } for (int i = sisOhjeAla.Count - 1; i >= 0; i--) { Pisteet l = new Pisteet(); l.X = sisOhjeAla[i].seulaArvo; l.Y = sisOhjeAla[i].tulos; o1.Add(l); } for (int i = sisOhjeYla.Count - 1; i >= 0; i--) { Pisteet l = new Pisteet(); l.X = sisOhjeYla[i].seulaArvo; l.Y = sisOhjeYla[i].tulos; o2.Add(l); } for (int i = uloOhjeAla.Count - 1; i >= 0; i--) { Pisteet l = new Pisteet(); l.X = uloOhjeAla[i].seulaArvo; l.Y = uloOhjeAla[i].tulos; o3.Add(l); } for (int i = uloOhjeYla.Count - 1; i >= 0; i--) { Pisteet l = new Pisteet(); l.X = uloOhjeYla[i].seulaArvo; l.Y = uloOhjeYla[i].tulos; o4.Add(l); } foreach (Pisteet e in la) { l1.Points.Add(new DataPoint(e.X, e.Y)); } foreach (Pisteet e in o1) { ohje1.Points.Add(new DataPoint(e.X, e.Y)); } foreach (Pisteet e in o2) { ohje2.Points.Add(new DataPoint(e.X, e.Y)); } foreach (Pisteet e in o3) { ohje3.Points.Add(new DataPoint(e.X, e.Y)); } foreach (Pisteet e in o4) { ohje4.Points.Add(new DataPoint(e.X, e.Y)); } //----------------------Kovakoodatut arvot, testitapaus----------------------------- /*double[] ar = new double[] { 0.063, 0.125, 0.25, 0.5, 1, 2, 4, 6, 8, 12, 16, 18, 20, 25, 30, 64, 100, 200 }; * double[] er = new double[] { 1.8, 3, 4.5, 5.6, 6.5, 8.3, 9.0, 9.9, 13.8, 15.6, 16.5, 17.4, 18.6, 20.4, 30.8, 31.4, 50.5, 62.7 }; * List<Pisteet> la = new List<Pisteet>(); * for (int i = 0; i < ar.Length; i++)//prosentit.Count * { * Pisteet l = new Pisteet(); * l.X = ar[i]; * l.Y = er[i]; * la.Add(l); * } * foreach (Pisteet e in la) * { * l1.Points.Add(new DataPoint(e.X, e.Y)); * }*///----------------------------------------------------------------------------------- model.Axes.Add(yaxis); model.Axes.Add(xaxis); //model.Axes.Add(caxis); model.Series.Add(l1); model.Series.Add(ohje1); model.Series.Add(ohje2); model.Series.Add(ohje3); model.Series.Add(ohje4); KiviModel = model; this.DataContext = this; }
public MassaKayra(Window mas, List <SeulakirjastoIndex> s, List <SeulaLapPros> p, List <Seulakirjasto> alls, List <SeulaLapPros> sisAla, List <SeulaLapPros> sisYla) { InitializeComponent(); _massa = (Massaohjelma)mas; seulat = s; prosentit = p; kaikkiseulat = alls; sisOhjeAla = sisAla; sisOhjeYla = sisYla; //Tällä saadaan osoitin toimimaan niin, että ei tarvitse muuta tehdä kuin laittaa hiiren osoitin koordinaattipisteen päälle //niin se näyttää koordinaattitiedot automaattisesti customController = new PlotController(); customController.UnbindMouseDown(OxyMouseButton.Left); customController.BindMouseEnter(PlotCommands.HoverSnapTrack); var model = new PlotModel { Title = "Rakeisuuskäyrä", Subtitle = "Vie hiiri pisteiden lähelle nähdäksesi arvot" }; model.PlotType = PlotType.XY; LinearAxis yaxis = new LinearAxis //Y-akseli { Maximum = 100, Minimum = 0, Title = "Prosentti", TickStyle = TickStyle.Inside, Position = AxisPosition.Left, //AbsoluteMaximum = 100, //AbsoluteMinimum = 0, MajorStep = 10, MinorStep = 2.5, MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dash, IsZoomEnabled = false, IsPanEnabled = false }; //------------------------------Logaritmiakseli------------------------- /*LogarithmicAxis xaxis = new LogarithmicAxis(); //X-akseli * if (seulat == null || prosentit == null || seulat.Count == 0 || prosentit.Count == 0) * { * xaxis.Title = "Seula"; * xaxis.TickStyle = TickStyle.Inside; * xaxis.Position = AxisPosition.Bottom; * xaxis.MajorGridlineStyle = LineStyle.Solid; * xaxis.MinorGridlineStyle = LineStyle.Dash; * //xaxis.Maximum = seulat[0].seula; * //xaxis.Minimum = seulat[(seulat.Count - 1)].seula; * xaxis.IsZoomEnabled = false; * xaxis.IsPanEnabled = false; * } * else * { * xaxis.Title = "Seula"; * xaxis.TickStyle = TickStyle.Inside; * xaxis.Position = AxisPosition.Bottom; * xaxis.MajorGridlineStyle = LineStyle.Solid; * xaxis.MinorGridlineStyle = LineStyle.Dash; * xaxis.Maximum = seulat[0].seula; * xaxis.Minimum = seulat[(seulat.Count - 1)].seula; * xaxis.IsZoomEnabled = false; * xaxis.IsPanEnabled = false; * * }*/ CategoryAxis caxis = new CategoryAxis();//X-akseli if (seulat == null || prosentit == null || seulat.Count == 0 || prosentit.Count == 0) { caxis.Title = "Seula"; caxis.TickStyle = TickStyle.Inside; caxis.Position = AxisPosition.Bottom; caxis.MajorGridlineStyle = LineStyle.Solid; caxis.MinorGridlineStyle = LineStyle.Dash; //caxis.Maximum = seulat[0].seula; //caxis.Minimum = seulat[(seulat.Count - 1)].seula; caxis.IsZoomEnabled = false; caxis.IsPanEnabled = false; } else { caxis.Title = "Seula"; caxis.TickStyle = TickStyle.Inside; caxis.Position = AxisPosition.Bottom; //caxis.MajorGridlineStyle = LineStyle.Solid; //caxis.MinorGridlineStyle = LineStyle.Dash; //caxis.Maximum = seulat[0].seula; //caxis.Minimum = seulat[(seulat.Count-1)].seula; caxis.IsZoomEnabled = true; caxis.IsPanEnabled = true; caxis.AxislineStyle = LineStyle.Solid; caxis.MinorStep = 1; } for (int i = kaikkiseulat.Count - 1; i >= 0; i--) //Laittaa Y-akselille otsikot, eli seulat jotka on käytössä tällä hetkellä { caxis.Labels.Add(kaikkiseulat[i].seula.ToString()); } LineSeries l1 = new LineSeries //Tuloskäyrä/viiva { Title = "Rakeisuuskäyrä", MarkerType = MarkerType.Circle, CanTrackerInterpolatePoints = false, MarkerSize = 5 }; LineSeries ohje1 = new LineSeries { MarkerType = MarkerType.None, CanTrackerInterpolatePoints = false, MarkerSize = 0, Color = OxyColors.Bisque }; LineSeries ohje2 = new LineSeries { MarkerType = MarkerType.None, CanTrackerInterpolatePoints = false, MarkerSize = 0, Color = OxyColors.Bisque }; LineSeries ohje3 = new LineSeries { MarkerType = MarkerType.None, CanTrackerInterpolatePoints = false, MarkerSize = 0, Color = OxyColors.BlanchedAlmond }; LineSeries ohje4 = new LineSeries { MarkerType = MarkerType.None, CanTrackerInterpolatePoints = false, MarkerSize = 0, Color = OxyColors.BlanchedAlmond }; seulat.Reverse(); /*sisOhjeAla.Reverse(); * sisOhjeYla.Reverse(); * uloOhjeAla.Reverse(); * uloOhjeYla.Reverse();*/ List <Pisteet> o1 = new List <Pisteet>(); List <Pisteet> o2 = new List <Pisteet>(); List <Pisteet> o3 = new List <Pisteet>(); List <Pisteet> o4 = new List <Pisteet>(); for (int i = sisOhjeAla.Count - 1; i >= 0; i--) { Pisteet l = new Pisteet(); l.X = sisOhjeAla[i].index; l.Y = sisOhjeAla[i].tulos; o1.Add(l); } for (int i = sisOhjeYla.Count - 1; i >= 0; i--) { Pisteet l = new Pisteet(); l.X = sisOhjeYla[i].index; l.Y = sisOhjeYla[i].tulos; o2.Add(l); } //------------------Käytetään CategoryAxisin kanssa-------------------- List <Pisteet> la = new List <Pisteet>(); //Pääviiva int j = 0; for (int i = prosentit.Count - 1; i >= 0; i--) { Pisteet l = new Pisteet(); l.X = seulat[i].index; l.Y = prosentit[j].tulos; la.Add(l); j++; }//-------------------------------------------------------------------- //---------------Käytetään LogarithmAxisin kanssa--------------------- /*for (int i = 0; i < prosentit.Count; i++) * { * Pisteet l = new Pisteet(); * l.X = seulat[i].seula;//seulat[i].seula kun käytetään LogarithmAxisia * l.Y = prosentit[i]; * la.Add(l); * }*///-------------------------------------------------------------------- foreach (Pisteet e in la) { l1.Points.Add(new DataPoint(e.X, e.Y)); } foreach (Pisteet e in o1) { ohje1.Points.Add(new DataPoint(e.X, e.Y)); } foreach (Pisteet e in o2) { ohje2.Points.Add(new DataPoint(e.X, e.Y)); } foreach (Pisteet e in o3) { ohje3.Points.Add(new DataPoint(e.X, e.Y)); } foreach (Pisteet e in o4) { ohje4.Points.Add(new DataPoint(e.X, e.Y)); } //----------------------Kovakoodatut arvot, testitapaus----------------------------- /*double[] ar = new double[] { 0.063, 0.125, 0.25, 0.5, 1, 2, 4, 6, 8, 12, 16, 18, 20, 25, 30, 64, 100, 200 }; * double[] er = new double[] { 1.8, 3, 4.5, 5.6, 6.5, 8.3, 9.0, 9.9, 13.8, 15.6, 16.5, 17.4, 18.6, 20.4, 30.8, 31.4, 50.5, 62.7 }; * List<Pisteet> la = new List<Pisteet>(); * for (int i = 0; i < ar.Length; i++)//prosentit.Count * { * Pisteet l = new Pisteet(); * l.X = ar[i]; * l.Y = er[i]; * la.Add(l); * } * foreach (Pisteet e in la) * { * l1.Points.Add(new DataPoint(e.X, e.Y)); * }*///----------------------------------------------------------------------------------- model.Axes.Add(yaxis); //model.Axes.Add(xaxis); model.Axes.Add(caxis); model.Series.Add(l1); model.Series.Add(ohje1); model.Series.Add(ohje2); model.Series.Add(ohje3); model.Series.Add(ohje4); MassaModel = model; this.DataContext = this; }