BioGTK  5.1.1
A .NET library & program for annotating, editing various microscopy imaging formats using Bioformats supported images.
Loading...
Searching...
No Matches
BioGTK.Plot Class Reference
Inheritance diagram for BioGTK.Plot:

Public Types

enum  PlotType { Bar , Scatter }
 

Public Member Functions

void UpdateImage ()
 

Static Public Member Functions

static Plot Create (double[] vals, string name)
 
static Plot Create (double[] vals, string name, PlotType typ)
 

Protected Member Functions

 Plot (Builder builder, IntPtr handle, double[] vals, string name, PlotType typ)
 

Properties

PlotType Type [get, set]
 
static Dictionary< string, PlotPlots [get]
 
List< double[]> Data [get, set]
 
Bitmap Image [get, set]
 
ScottPlot.Plot Model [get, set]
 
static Plot SelectedPlot [get]
 

Member Enumeration Documentation

◆ PlotType

Enumerator
Bar 
Scatter 

Constructor & Destructor Documentation

◆ Plot()

BioGTK.Plot.Plot ( Builder  builder,
IntPtr  handle,
double[]  vals,
string  name,
PlotType  typ 
)
inlineprotected
140 : base(handle)
141 {
142 _builder = builder;
143 builder.Autoconnect(this);
144 model = new ScottPlot.Plot();
145 data.Add(vals);
146 if (typ == PlotType.Scatter)
147 InitScatter();
148 else
149 if (typ == PlotType.Bar)
150 InitBars();
151 if (!name.EndsWith(".png") || !name.EndsWith(".PNG"))
152 file = name + ".png";
153 this.Title = name;
154 image.Drawn += Image_Drawn;
155 image.SizeAllocated += Image_SizeAllocated;
156 image.ButtonPressEvent += Image_ButtonPressEvent;
157 barMenu.ButtonPressEvent += BarMenu_ButtonPressEvent;
158 scatterMenu.ButtonPressEvent += ScatterMenu_ButtonPressEvent;
159 saveImageMenu.ButtonPressEvent += SaveImageMenu_ButtonPressEvent;
160 saveCSVMenu.ButtonPressEvent += SaveCSVMenu_ButtonPressEvent;
161 this.DeleteEvent += About_DeleteEvent;
162 this.name = name;
163 selected = this;
164 if(plots.ContainsKey(name))
165 plots[name] = this;
166 else
167 plots.Add(name,this);
168 App.ApplyStyles(this);
169 }
PlotType
Definition Plot.cs:29
Plot(Builder builder, IntPtr handle, double[] vals, string name, PlotType typ)
Definition Plot.cs:140

Member Function Documentation

◆ Create() [1/2]

static Plot BioGTK.Plot.Create ( double[]  vals,
string  name 
)
inlinestatic

It creates a new instance of the Plot class.

Returns
A new instance of the Plot class.
126 {
127 Builder builder = new Builder(new FileStream(System.IO.Path.GetDirectoryName(Environment.ProcessPath) + "/" + "Glade/Plot.glade", FileMode.Open));
128 return new Plot(builder, builder.GetObject("plot").Handle, vals, name, PlotType.Scatter);
129 }

◆ Create() [2/2]

static Plot BioGTK.Plot.Create ( double[]  vals,
string  name,
PlotType  typ 
)
inlinestatic

It creates a new instance of the Plot class.

Returns
A new instance of the Plot class.
134 {
135 Builder builder = new Builder(new FileStream("Glade/Plot.glade", FileMode.Open));
136 return new Plot(builder, builder.GetObject("plot").Handle, vals, name, typ);
137 }

◆ UpdateImage()

void BioGTK.Plot.UpdateImage ( )
inline

The function updates an image by saving it as a PNG file, setting the window title, creating a new Pixbuf object from the file, and redrawing the image.

61 {
62 model.SavePng(file, AllocatedWidth, AllocatedHeight);
63 this.Title = name;
64 pixbuf = new Pixbuf(file);
65 image.QueueDraw();
66 }

Property Documentation

◆ Data

List<double[]> BioGTK.Plot.Data
getset
44 {
45 get { return data; }
46 set { data = value; UpdateImage(); }
47 }
void UpdateImage()
Definition Plot.cs:60

◆ Image

Bitmap BioGTK.Plot.Image
getset
49 {
50 get { return bitmap; }
51 set { bitmap = value; }
52 }

◆ Model

ScottPlot.Plot BioGTK.Plot.Model
getset
54 {
55 get { return model; }
56 set { model = value; UpdateImage(); }
57 }

◆ Plots

Dictionary<string,Plot> BioGTK.Plot.Plots
staticget
40 {
41 get { return plots; }
42 }

◆ SelectedPlot

Plot BioGTK.Plot.SelectedPlot
staticget
288 {
289 get { return selected; }
290 }

◆ Type

PlotType BioGTK.Plot.Type
getset
35 {
36 get { return type; }
37 set { type = value; }
38 }

The documentation for this class was generated from the following file: