void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 5 "..\..\..\..\xaml\HeavyMetal\CurveWindow.xaml" ((AIO.xaml.HeavyMetal.CurveWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden return; case 2: this.plotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target)); return; case 3: this.dianwei = ((Microsoft.Research.DynamicDataDisplay.Header)(target)); return; case 4: this.dianliu = ((Microsoft.Research.DynamicDataDisplay.VerticalAxisTitle)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.DataPlot = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target)); return; case 2: this.PlotTitle = ((Microsoft.Research.DynamicDataDisplay.Header)(target)); return; case 3: this.PlotYLabel = ((Microsoft.Research.DynamicDataDisplay.VerticalAxisTitle)(target)); return; case 4: this.DataLabel = ((System.Windows.Controls.Label)(target)); return; case 5: this.ValueLabel = ((System.Windows.Controls.Label)(target)); return; } this._contentLoaded = true; }
void PlotterConfigurator_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { if (DataContext != null) { x = ((ChartPlotter)DataContext).Children.OfType<HorizontalAxisTitle>().FirstOrDefault(); y = ((ChartPlotter)DataContext).Children.OfType<VerticalAxisTitle>().FirstOrDefault(); tx.Text = x.Content.ToString(); ty.Text = y.Content.ToString(); } }
void Page_Loaded(object sender, RoutedEventArgs e) { mainHeader = new Header(); TextBlock anotherHeaderText = new TextBlock(); anotherHeaderText.Text = "Layout Tutorial"; anotherHeaderText.TextAlignment = TextAlignment.Center; anotherHeaderText.FontSize = 22; mainHeader.Content = anotherHeaderText; PlotterMain.Children.Add(mainHeader); additioanlHeader = new Header(); TextBlock headerText = new TextBlock(); headerText.Text = "Additional header"; headerText.FontSize = 20; headerText.FontWeight = FontWeights.Bold; additioanlHeader.Content = headerText; PlotterMain.Children.Add(additioanlHeader); footer = new Footer(); TextBlock footerText = new TextBlock(); footerText.Text = "Small footer"; footerText.FontSize = 8; footerText.FontStyle = FontStyles.Italic; footer.Content = footerText; TextBlock vertTitleTextBlock = new TextBlock(); vertTitleTextBlock.Text = "This is Vertical title"; //Only VerticalAxisTitle should be created this way, to create HorizonatalAxisTitle use its Content property //DO NOT use Content property in VerticalAxisTitle vertTitle = new VerticalAxisTitle(vertTitleTextBlock); PlotterMain.Children.Add(vertTitle); //Use Content property of the HorizontalAxisTitle to set its content horiTitle = new HorizontalAxisTitle(); horiTitle.Content = new TextBlock() { Text="Horizontal axis title set from code",HorizontalAlignment= HorizontalAlignment.Center}; PlotterMain.Children.Add(horiTitle); TextBoxUpperHeaderTitle.Text = anotherHeaderText.Text; TextBoxVerticalTitle.Text = vertTitleTextBlock.Text; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.plotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target)); return; case 2: this.dateAxis = ((Microsoft.Research.DynamicDataDisplay.Charts.Axes.HorizontalIntegerAxis)(target)); return; case 3: this.countAxis = ((Microsoft.Research.DynamicDataDisplay.Charts.Axes.VerticalIntegerAxis)(target)); return; case 4: this.graphTitle = ((Microsoft.Research.DynamicDataDisplay.Header)(target)); return; case 5: this.verticalAxisTitle = ((Microsoft.Research.DynamicDataDisplay.VerticalAxisTitle)(target)); return; case 6: this.horizontalAxisTitle = ((Microsoft.Research.DynamicDataDisplay.HorizontalAxisTitle)(target)); return; } this._contentLoaded = true; }
private void DrawPlots() { HorizontalAxis xAxis = (HorizontalAxis)plotter.MainHorizontalAxis; xAxis.TicksProvider = new LogarithmNumericTicksProvider(10); xAxis.LabelProvider = new UnroundingLabelProvider(); xAxis.ShowMajorLabels = true; xAxis.ShowMinorTicks = true; xAxis.SnapsToDevicePixels = true; xAxis.LabelProvider.SetCustomFormatter(info => info.Tick.ToString("#.######e0")); HorizontalAxisTitle HAT = new HorizontalAxisTitle() { Content = _xAxisInfo.AxisTitle }; plotter.MainHorizontalAxis = xAxis; plotter.Children.Add(HAT); ((NumericAxis)plotter.MainHorizontalAxis).AxisControl.TicksPath.Stroke = Brushes.Blue; VerticalAxis yAxis = (VerticalAxis)plotter.MainVerticalAxis; yAxis.TicksProvider = new NumericTicksProvider(); yAxis.LabelProvider = new UnroundingLabelProvider(); yAxis.ShowMajorLabels = true; yAxis.ShowMinorTicks = true; yAxis.SnapsToDevicePixels = true; VerticalAxisTitle VAT = new VerticalAxisTitle() { Content = _yAxisInfoList[0].AxisTitle }; plotter.MainVerticalAxis = yAxis; plotter.Children.Add(VAT); plotter.AxisGrid.DrawVerticalMinorTicks = true; plotter.AxisGrid.DrawHorizontalMinorTicks = true; plotter.MainVerticalAxis.Background = new LinearGradientBrush(Colors.White, Colors.LightGray, 90); var xPoints = _xAxisInfo.AxisDataPoints.AsXDataSource(); // Create the main plot foreach (AxisInfo yAxInfo in _yAxisInfoList) { var yPoints = yAxInfo.AxisDataPoints.AsYDataSource(); CompositeDataSource plot = xPoints.Join(yPoints); plotter.AddLineGraph(plot, yAxInfo.PlotColor, yAxInfo.PlotLineThickness, yAxInfo.AxisLegend); } // add secondary y-axis plots if any exist if (_yAxisInfoSecList != null) { InjectedPlotter innerPlotter = new InjectedPlotter(); innerPlotter.SetViewportBinding = false; plotter.Children.Add(innerPlotter); HorizontalAxis ax = new HorizontalAxis(); ax.Placement = AxisPlacement.Top; ax.TicksProvider = new LogarithmNumericTicksProvider(10); ax.LabelProvider = new UnroundingLabelProvider(); ax.LabelProvider.SetCustomFormatter(info => info.Tick.ToString("#.######e0")); ax.ShowMajorLabels = true; ax.ShowMinorTicks = true; ax.SnapsToDevicePixels = true; ax.AxisControl.TicksPath.Stroke = Brushes.Red; plotter.Children.Add(ax); VerticalAxis yAxisSec = new VerticalAxis() { TicksProvider = new NumericTicksProvider(), LabelProvider = new UnroundingLabelProvider(), ShowMinorTicks = true, ShowMajorLabels = true, SnapsToDevicePixels = true, Placement = AxisPlacement.Right }; VerticalAxisTitle VATsecondary = new VerticalAxisTitle() { Content = _yAxisInfoSecList[0].AxisTitle, Placement = AxisPlacement.Right }; innerPlotter.MainVerticalAxis = yAxisSec; innerPlotter.Children.Add(VATsecondary); innerPlotter.MainVerticalAxis.Background = new LinearGradientBrush(Colors.White, Colors.Red, 90); foreach (AxisInfo yAxInfoSec in _yAxisInfoSecList) { var ySecPoints = yAxInfoSec.AxisDataPoints.AsYDataSource(); CompositeDataSource plotSec = xPoints.Join(ySecPoints); /*innerP*/ plotter.AddLineGraph(plotSec, yAxInfoSec.PlotColor, yAxInfoSec.PlotLineThickness, yAxInfoSec.AxisLegend); } } }
public void SetVerticalTitle(string title) { VerticalAxisTitle vt; if (m_Plotter.Children.OfType<VerticalAxisTitle>().Count() == 1) { vt = m_Plotter.Children.OfType<VerticalAxisTitle>().Single(); m_Plotter.Children.Remove(vt); } vt = new VerticalAxisTitle(); vt.Content = title; m_Plotter.Children.Add(vt); }
private void ButtonChangeVertAxis_CLick(object sender, RoutedEventArgs e) { if (vertTitle != null) PlotterMain.Children.Remove(vertTitle); TextBlock newTitleTextBlock = new TextBlock(); newTitleTextBlock.Text = TextBoxVerticalTitle.Text; vertTitle = new VerticalAxisTitle(newTitleTextBlock); PlotterMain.Children.Add(vertTitle); }
private void MakePlots() { if (!PlotsMade) //Only do this once { Model mShe = new Model(SheFileName); DFS3 dfs = new DFS3(Dfs3FileName); Item dfsI = dfs.Items[ItemNumber - 1]; List<TimestampSeries> well_Concentration = new List<TimestampSeries>(); int[] TimeSteps = ParseString(TimeStepsAsString, 0, dfs.NumberOfTimeSteps - 1); int[] WellNumbers = ParseString(WellsAsString, 0, mShe.ExtractionWells.Count - 1); List<MikeSheWell> wells = new List<MikeSheWell>(); foreach (int j in WellNumbers) wells.Add(mShe.ExtractionWells[j]); foreach (int i in TimeSteps) { int k = 0; foreach (var w in wells) { if (i == TimeSteps[0]) well_Concentration.Add(new TimestampSeries(w.ID, new Unit(dfsI.EumQuantity.UnitAbbreviation, 1, 0))); well_Concentration[k].Items.Add(new TimestampValue(dfs.TimeSteps[i], (dfs.GetData(i, ItemNumber)[w.Row, w.Column, w.Layer]))); k++; } } //Sets the upper title Header.Content = dfsI.Name; //Sets the title of the y-axis var ytitle = new VerticalAxisTitle(); ytitle.Content = dfsI.EumQuantity.ItemDescription + " [" + dfsI.EumQuantity.UnitAbbreviation + "]"; TheChart.Children.Add(ytitle); int l = 0; //Loop the wells for plotting foreach (var w in wells) { if (g != null) { TheChart.Children.Remove(g); TheChart.FitToView(); } var axis = new Microsoft.Research.DynamicDataDisplay.Charts.HorizontalDateTimeAxis(); TheChart.MainHorizontalAxis = axis; TheChart.MainVerticalAxis = new Microsoft.Research.DynamicDataDisplay.Charts.VerticalAxis(); //set the data source EnumerableDataSource<TimestampValue> ds = new EnumerableDataSource<TimestampValue>(well_Concentration[l].Items); ds.SetXMapping(var => axis.ConvertToDouble(var.Time)); ds.SetYMapping(var => var.Value); //create the graph g = TheChart.AddLineGraph(ds, new Pen(Brushes.Black, 3), new PenDescription(w.ID)); //create a filename outfile = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Dfs3FileName), "Well_No" + "_" + WellNumbers[l].ToString() + "_" + dfsI.EumQuantity.ItemDescription); //now save to file this.UpdateLayout(); MainWindow.SaveScreen(this, outfile + ".jpg", (int)ActualWidth, (int)ActualHeight); //Now create the dfs0-file using (DFS0 dfs0 = new DFS0(outfile + ".dfs0", 1)) { dfs0.FirstItem.Name = dfsI.Name; dfs0.FirstItem.EumItem = dfsI.EumItem; dfs0.FirstItem.EumUnit = dfsI.EumUnit; dfs0.FirstItem.ValueType = dfsI.ValueType; int t = 0; foreach (var v in well_Concentration[l].Items) { dfs0.InsertTimeStep(v.Time); dfs0.SetData(t, 1, v.Value); t++; } } //Now create the text-file using (StreamWriter sw = new StreamWriter(outfile + ".txt", false)) { foreach (var v in well_Concentration[l].Items) { sw.WriteLine(v.Time + "; " + v.Value); } } l++; } mShe.Dispose(); dfs.Dispose(); PlotsMade = true; } }
private void drowChartPlotter(ChartPlotter cp) { this.chartGrid_.Children.Clear(); Header h = new Header(); h.Content = "Payoff"; cp.Children.Add(h); VerticalAxisTitle vat = new VerticalAxisTitle(); vat.Content = "억원"; HorizontalAxisTitle hat = new HorizontalAxisTitle(); hat.Content = "P"; cp.Children.Add(vat); cp.Children.Add(hat); }