void Show2D(Tables.Denso.Table2D table) { if (table == null) { return; } navbarwidget.CurrentPos = table.Location; navbarwidget.SetMarkedPositions(new int[] { table.RangeX.Pos, table.RangeY.Pos }); // plot plot2D.Draw(table); // table data as text var values = table.GetValuesYasFloats(); var tableUI = new GtkWidgets.TableWidget2D(coloring, table.ValuesX, values, table.Xmin, table.Xmax, table.Ymin, table.Ymax); tableUI.HeaderAxisMarkup = Util.Markup.Unit(table.UnitX); tableUI.HeaderValuesMarkup = Util.Markup.Unit(table.UnitY); tableUI.AxisXMarkup = Util.Markup.NameUnit(table.NameX, table.UnitX); tableUI.ValuesMarkup = Util.Markup.NameUnit(table.Title, table.UnitY); tableUI.FormatValues = ScoobyRom.Data.AutomaticValueFormat(values, table.Ymin, table.Ymax); // Viewport needed for ScrolledWindow to work as generated table widget has no scroll support var viewPort = new Gtk.Viewport(); viewPort.Add(tableUI.Create()); Gtk.Widget previous = this.scrolledwindowTable2D.Child; if (previous != null) { this.scrolledwindowTable2D.Remove(previous); } // previous.Dispose () or previous.Destroy () cause NullReferenceException! this.scrolledwindowTable2D.Add(viewPort); this.scrolledwindowTable2D.ShowAll(); }
static void WriteGnuPlotBinary(BinaryWriter bw, Table2D table2D) { float[] valuesX = table2D.ValuesX; bw.Write ((float)(valuesX.Length)); foreach (var x in valuesX) { bw.Write (x); } // same format as 3D but only write a single row float[] valuesY = table2D.GetValuesYasFloats (); bw.Write (0f); for (int ix = 0; ix < valuesX.Length; ix++) { bw.Write (valuesY [ix]); } }