Esempio n. 1
0
        /// <summary>
        /// Helper method for Clone.
        /// </summary>
        /// <param name="a">The original object to clone.</param>
        /// <param name="b">The cloned object.</param>
        protected static void DoClone(LabelAxis b, LabelAxis a)
        {
            Axis.DoClone(b, a);

            a.labels  = (ArrayList)b.labels.Clone();
            a.numbers = (ArrayList)b.numbers.Clone();

            a.ticksBetweenText    = b.ticksBetweenText;
            a.sortDataIfNecessary = b.sortDataIfNecessary;
        }
Esempio n. 2
0
        /// <summary>
        /// Deep copy of LabelAxis.
        /// </summary>
        /// <returns>A copy of the LinearAxis Class.</returns>
        public override object Clone()
        {
            LabelAxis a = new LabelAxis();

            // ensure that this isn't being called on a derived type. If it is, then oh no!
            if (this.GetType() != a.GetType())
            {
                throw new XwPlotException("Error. Clone method is not defined in derived type.");
            }
            DoClone(this, a);
            return(a);
        }
Esempio n. 3
0
        public StackedHistogram()
        {
            infoText = "";
            infoText += "Stacked Histogram Sample. Also demonstrates - \n";
            infoText += " * Label Axis with angled text. \n";
            infoText += " * ColorGradient Bars fill";

            plotCanvas.Clear();

            Grid myGrid = new Grid();
            myGrid.VerticalGridType = Grid.GridType.Coarse;
            double[] pattern = {1.0, 2.0};
            myGrid.MajorGridDash = pattern;

            myGrid.MajorGridColor = Colors.LightGray;
            plotCanvas.Add (myGrid);

            // set up Histogram dataSets manually
            double[] xs = {20.0, 31.0, 27.0, 38.0, 24.0, 3.0, 2.0};
            double[] xs2 = {7.0, 10.0, 42.0, 9.0, 2.0, 79.0, 70.0};
            double[] xs3 = {1.0, 20.0, 20.0, 25.0, 10.0, 30.0, 30.0};

            HistogramPlot hp1 = new HistogramPlot ();
            hp1.DataSource = xs;
            hp1.BaseWidth = 0.6;
            hp1.FillGradient = new ColorGradient (Colors.LightGreen, Colors.White);
            hp1.Filled = true;
            hp1.Label = "Developer Work";

            HistogramPlot hp2 = new HistogramPlot ();
            hp2.DataSource = xs2;
            hp2.Label = "Web Browsing";
            hp2.FillGradient = new ColorGradient (Colors.LightBlue, Colors.White);
            hp2.Filled = true;
            hp2.StackedTo (hp1);

            HistogramPlot hp3 = new HistogramPlot ();
            hp3.DataSource = xs3;
            hp3.Label = "P2P Downloads";
            hp3.FillGradient = new ColorGradient (Colors.Red, Colors.White);
            hp3.Filled = true;
            hp3.StackedTo (hp2);

            plotCanvas.Add (hp1);
            plotCanvas.Add (hp2);
            plotCanvas.Add (hp3);

            plotCanvas.Legend = new Legend();

            LabelAxis la = new LabelAxis (plotCanvas.XAxis1);
            la.AddLabel ("Monday", 0.0);
            la.AddLabel ("Tuesday", 1.0);
            la.AddLabel ("Wednesday", 2.0);
            la.AddLabel ("Thursday", 3.0);
            la.AddLabel ("Friday", 4.0);
            la.AddLabel ("Saturday", 5.0);
            la.AddLabel ("Sunday", 6.0);
            la.Label = "Days";
            la.TickTextFont = Font.FromName ("Courier New").WithSize (8);
            la.TicksBetweenText = true;

            plotCanvas.XAxis1 = la;
            plotCanvas.YAxis1.WorldMin = 0.0;
            plotCanvas.YAxis1.Label = "MBytes";
            ((LinearAxis)plotCanvas.YAxis1).NumberOfSmallTicks = 1;

            plotCanvas.Title = "Internet useage for user:\n johnc 09/01/03 - 09/07/03";

            plotCanvas.XAxis1.TickTextAngle = 30.0;

            PackStart (plotCanvas.Canvas, true);
            Label l = new Label (infoText);
            PackStart (l);
        }
Esempio n. 4
0
        public LabelPointPlotSample()
        {
            infoText = "";
            infoText += "Cs2Te Photocathode QE evolution Example. Demonstrates - \n";
            infoText += "  * LabelPointPlot (allows text to be associated with points) \n";
            infoText += "  * PointPlot droplines \n";
            infoText += "  * LabelAxis \n";
            infoText += "  * PhysicalSpacingMin property of LabelAxis \n";

            qeExampleTimerEnabled = true;
            plotCanvas.Clear ();

            int len = 24;
            string[] s = new string[len];
            PlotQEExampleValues = new double[len];
            PlotQEExampleTextValues = new string[len];

            Random r = new Random ();

            for (int i=0; i<len;i++) {
                PlotQEExampleValues[i] = 8.0 + 12.0 * (double)r.Next(10000) / 10000.0;
                if (PlotQEExampleValues[i] > 18.0) {
                    PlotQEExampleTextValues[i] = "KCsTe";
                }
                else {
                    PlotQEExampleTextValues[i] = "";
                }
                s[i] = i.ToString("00") + ".1";
            }

            PointPlot pp = new PointPlot ();
            pp.DataSource = PlotQEExampleValues;
            pp.Marker = new Marker (Marker.MarkerType.Square, 10);
            pp.Marker.DropLine = true;
            pp.Marker.LineColor = Colors.CornflowerBlue;
            pp.Marker.Filled = false;
            plotCanvas.Add (pp);

            LabelPointPlot tp1 = new LabelPointPlot ();
            tp1.DataSource = PlotQEExampleValues;
            tp1.TextData = PlotQEExampleTextValues;
            tp1.LabelTextPosition = LabelPointPlot.LabelPositions.Above;
            tp1.Marker = new Marker (Marker.MarkerType.None, 10);
            plotCanvas.Add (tp1);

            LabelAxis la = new LabelAxis (plotCanvas.XAxis1);
            for (int i=0; i<len; ++i) {
                la.AddLabel (s[i], i);
            }
            Font ff = Font.FromName ("Verdana");
            la.TickTextFont = ff.WithSize (7);
            la.PhysicalSpacingMin = 25;
            plotCanvas.XAxis1 = la;

            plotCanvas.Title = "Cs2Te Photocathode QE evolution";
            plotCanvas.TitleFont = ff.WithSize (15);
            plotCanvas.XAxis1.WorldMin = -1.0;
            plotCanvas.XAxis1.WorldMax = len;
            plotCanvas.XAxis1.LabelFont = ff.WithSize (10);
            plotCanvas.XAxis1.Label = "Cathode ID";
            plotCanvas.YAxis1.Label = "QE [%]";
            plotCanvas.YAxis1.LabelFont = ff.WithSize (10);
            plotCanvas.YAxis1.TickTextFont = ff.WithSize (10);

            plotCanvas.YAxis1.WorldMin = 0.0;
            plotCanvas.YAxis1.WorldMax= 25.0;
            plotCanvas.XAxis1.TickTextAngle = 60.0;

            // Add timer into Xwt loop for data updates
            Application.TimeoutInvoke (750, qeExampleTimer_Tick);

            PackStart (plotCanvas.Canvas, true);
            Label info = new Label (infoText);
            PackStart (info);
        }
Esempio n. 5
0
        /// <summary>
        /// Helper method for Clone.
        /// </summary>
        /// <param name="a">The original object to clone.</param>
        /// <param name="b">The cloned object.</param>
        protected static void DoClone(LabelAxis b, LabelAxis a)
        {
            Axis.DoClone (b, a);

            a.labels = (ArrayList)b.labels.Clone();
            a.numbers = (ArrayList)b.numbers.Clone();

            a.ticksBetweenText = b.ticksBetweenText;
            a.sortDataIfNecessary = b.sortDataIfNecessary;
        }
Esempio n. 6
0
 /// <summary>
 /// Deep copy of LabelAxis.
 /// </summary>
 /// <returns>A copy of the LinearAxis Class.</returns>
 public override object Clone()
 {
     LabelAxis a = new LabelAxis ();
     // ensure that this isn't being called on a derived type. If it is, then oh no!
     if (this.GetType () != a.GetType ()) {
         throw new XwPlotException ("Error. Clone method is not defined in derived type.");
     }
     DoClone( this, a );
     return a;
 }