private void FillDataOptions() { GraphDataSet data = lstDataSets.SelectedItem as GraphDataSet; txtName.Text = data.Name; lblColor.BackColor = data.Color; chkDrawDataset.Checked = data.DrawDataset; chkDrawLines.Checked = data.DrawLine; chkDrawPoints.Checked = data.DrawPoints; chkLegend.Checked = data.ShowInLegend; cboPointStyle.SelectedItem = data.PointType; cboLineStyle.SelectedItem = data.LineStyle; nudLineWeight.Value = (decimal)data.LineWeight; }
private void ApplyChanges() { GraphDataSet data = lstDataSets.SelectedItem as GraphDataSet; data.Name = txtName.Text; data.Color = lblColor.BackColor; data.DrawDataset = chkDrawDataset.Checked; data.DrawLine = chkDrawLines.Checked; data.DrawPoints = chkDrawPoints.Checked; data.ShowInLegend = chkLegend.Checked; data.PointType = (GraphDataSet.SymbolType)cboPointStyle.SelectedItem; data.LineStyle = (GraphDataSet.LineType)cboLineStyle.SelectedItem; data.LineWeight = (float)nudLineWeight.Value; mGraph.Invalidate(); }
void WriteDataSet(int index, GraphDataSet set) { string indexString = "S" + index.ToString(); mFile.Write("@target G0.{0}\n@type xy\n", indexString); for (int i = 0; i < set.Count; i++) { if (float.IsNaN(set[i].X) || float.IsNaN(set[i].Y)) { continue; } if (float.IsInfinity(set[i].X) || float.IsInfinity(set[i].Y)) { continue; } mFile.Write("{0} {1}\n", set[i].X, set[i].Y); } mFile.Write("&\n"); }
void WriteDataSetHeader(int index, GraphDataSet set) { string indexString = "s" + index.ToString(); string colorString = ColorIndex(set.Color).ToString(); int symbol = 0; if (set.DrawPoints) { switch (set.PointType) { case GraphDataSet.SymbolType.Square: symbol = 2; break; case GraphDataSet.SymbolType.Circle: symbol = 1; break; case GraphDataSet.SymbolType.Point: symbol = 3; break; } } int lineType = 0; if (set.DrawLine) { switch (set.LineStyle) { case GraphDataSet.LineType.Solid: lineType = 1; break; case GraphDataSet.LineType.Dashed: lineType = 2; break; case GraphDataSet.LineType.Dotted: lineType = 3; break; } } string header = "@ " + indexString + " hidden false\n" + "@ " + indexString + " type xy\n" + "@ " + indexString + " symbol " + symbol + "\n" + "@ " + indexString + " symbol size 1.000000\n" + "@ " + indexString + " symbol color " + colorString + "\n" + "@ " + indexString + " symbol pattern 1\n" + "@ " + indexString + " symbol fill color 1\n" + "@ " + indexString + " symbol fill pattern 0\n" + "@ " + indexString + " symbol linewidth " + set.LineWeight + "\n" + "@ " + indexString + " symbol linestyle 1\n" + "@ " + indexString + " symbol char 65\n" + "@ " + indexString + " symbol char font 0\n" + "@ " + indexString + " symbol skip 0\n" + "@ " + indexString + " line type " + lineType + "\n" + "@ " + indexString + " line linestyle 1\n" + "@ " + indexString + " line linewidth " + set.LineWeight + "\n" + "@ " + indexString + " line color " + colorString + "\n" + "@ " + indexString + " line pattern 1\n" + "@ " + indexString + " baseline type 0\n" + "@ " + indexString + " baseline off\n" + "@ " + indexString + " dropline off\n" + "@ " + indexString + " fill type 0\n" + "@ " + indexString + " fill rule 0\n" + "@ " + indexString + " fill color " + colorString + "\n" + "@ " + indexString + " fill pattern 1\n" + "@ " + indexString + " avalue off\n" + "@ " + indexString + " avalue type 2\n" + "@ " + indexString + " avalue char size 1.000000\n" + "@ " + indexString + " avalue font 0\n" + "@ " + indexString + " avalue color " + colorString + "\n" + "@ " + indexString + " avalue rot 0\n" + "@ " + indexString + " avalue format general\n" + "@ " + indexString + " avalue prec 3\n" + "@ " + indexString + " avalue prepend \"\"\n" + "@ " + indexString + " avalue append \"\"\n" + "@ " + indexString + " avalue offset 0.000000 , 0.000000\n" + "@ " + indexString + " errorbar on\n" + "@ " + indexString + " errorbar place both\n" + "@ " + indexString + " errorbar color " + colorString + "\n" + "@ " + indexString + " errorbar pattern 1\n" + "@ " + indexString + " errorbar size 1.000000\n" + "@ " + indexString + " errorbar linewidth 1.0\n" + "@ " + indexString + " errorbar linestyle 1\n" + "@ " + indexString + " errorbar riser linewidth 1.0\n" + "@ " + indexString + " errorbar riser linestyle 1\n" + "@ " + indexString + " errorbar riser clip off\n" + "@ " + indexString + " errorbar riser clip length 0.100000\n" + "@ " + indexString + " comment \"\"\n" + "@ " + indexString + " legend \"\"\n" ; mFile.Write(header); }