Exemplo n.º 1
0
        public void ChartWithDataTableAsSeriesSource()
        {
            var table = new DataTable();
            table.Columns.Add("x", typeof (double));
            table.Columns.Add("y", typeof (double));

            table.Rows.Add(2.5, 33.3);
            table.Rows.Add(0.5, 13.3);

            // create chart and add function as a data source using object adapter class FunctionSeriesDataSource
            //IChart chart = new Chart();

            IChartSeries series = ChartSeriesFactory.CreateLineSeries();

            series.DataSource = table;
            series.XValuesDataMember = "x";
            series.YValuesDataMember = "y";

            var chartView1 = new ChartView() ;

            chartView1.Chart.Series.Add(series);

            var form = new Form {Width = 600, Height = 100};
            form.Controls.Add(chartView1);
            WindowsFormsTestHelper.ShowModal(form);
        }
Exemplo n.º 2
0
 ///<summary>Inserts one ChartView into the database.  Returns the new priKey.</summary>
 internal static long Insert(ChartView chartView)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         chartView.ChartViewNum=DbHelper.GetNextOracleKey("chartview","ChartViewNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(chartView,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     chartView.ChartViewNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(chartView,false);
     }
 }
Exemplo n.º 3
0
 ///<summary>Inserts one ChartView into the database.  Provides option to use the existing priKey.</summary>
 internal static long Insert(ChartView chartView,bool useExistingPK)
 {
     if(!useExistingPK && PrefC.RandomKeys) {
         chartView.ChartViewNum=ReplicationServers.GetKey("chartview","ChartViewNum");
     }
     string command="INSERT INTO chartview (";
     if(useExistingPK || PrefC.RandomKeys) {
         command+="ChartViewNum,";
     }
     command+="Description,ItemOrder,ProcStatuses,ObjectTypes,ShowProcNotes,IsAudit,SelectedTeethOnly,OrionStatusFlags,DatesShowing) VALUES(";
     if(useExistingPK || PrefC.RandomKeys) {
         command+=POut.Long(chartView.ChartViewNum)+",";
     }
     command+=
          "'"+POut.String(chartView.Description)+"',"
         +    POut.Int   (chartView.ItemOrder)+","
         +    POut.Int   ((int)chartView.ProcStatuses)+","
         +    POut.Int   ((int)chartView.ObjectTypes)+","
         +    POut.Bool  (chartView.ShowProcNotes)+","
         +    POut.Bool  (chartView.IsAudit)+","
         +    POut.Bool  (chartView.SelectedTeethOnly)+","
         +    POut.Int   ((int)chartView.OrionStatusFlags)+","
         +    POut.Int   ((int)chartView.DatesShowing)+")";
     if(useExistingPK || PrefC.RandomKeys) {
         Db.NonQ(command);
     }
     else {
         chartView.ChartViewNum=Db.NonQ(command,true);
     }
     return chartView.ChartViewNum;
 }
Exemplo n.º 4
0
        public void Show()
        {
            IFunction function1 = GetFunction1Arg1Comp();
            IFunction function2 = GetFunction1Arg1Comp();
            IFunction function3 = GetFunction1Arg1Comp();

            function1[1.0] = 2.0;
            function1[2.0] = 5.0;
            function1[3.0] = 1.0;

            function2[1.0] = 20.0;
            function2[2.0] = 50.0;
            function2[3.0] = 10.0;

            function3[3.0] = 20;
            function3[4.0] = 50;

            var view = new ChartView();

            ILineChartSeries lineSeries1 = GetLineSeries(function1, view);
            ILineChartSeries lineSeries2 = GetLineSeries(function2, view);
            ILineChartSeries lineSeries3 = GetLineSeries(function3, view);

            view.Chart.Series.Add(lineSeries1);
            view.Chart.Series.Add(lineSeries2);
            view.Chart.Series.Add(lineSeries3);

            var tool = view.NewSeriesBandTool(lineSeries1, lineSeries2, Color.Green);

            WindowsFormsTestHelper.ShowModal(view);
        }
Exemplo n.º 5
0
        private static ILineChartSeries GetLineSeries(IFunction function, ChartView view)
        {
            ILineChartSeries ls = ChartSeriesFactory.CreateLineSeries();
            ls.YValuesDataMember = function.Components[0].DisplayName;
            ls.XValuesDataMember = function.Arguments[0].DisplayName;

            var functionBindingList = new FunctionBindingList(function) { SynchronizeInvoke = view};
            ls.DataSource = functionBindingList;
            return ls;
        }
Exemplo n.º 6
0
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<ChartView> TableToList(DataTable table){
			List<ChartView> retVal=new List<ChartView>();
			ChartView chartView;
			for(int i=0;i<table.Rows.Count;i++) {
				chartView=new ChartView();
				chartView.ChartViewNum     = PIn.Long  (table.Rows[i]["ChartViewNum"].ToString());
				chartView.Description      = PIn.String(table.Rows[i]["Description"].ToString());
				chartView.ItemOrder        = PIn.Int   (table.Rows[i]["ItemOrder"].ToString());
				chartView.ProcStatuses     = (ChartViewProcStat)PIn.Int(table.Rows[i]["ProcStatuses"].ToString());
				chartView.ObjectTypes      = (ChartViewObjs)PIn.Int(table.Rows[i]["ObjectTypes"].ToString());
				chartView.ShowProcNotes    = PIn.Bool  (table.Rows[i]["ShowProcNotes"].ToString());
				chartView.IsAudit          = PIn.Bool  (table.Rows[i]["IsAudit"].ToString());
				chartView.SelectedTeethOnly= PIn.Bool  (table.Rows[i]["SelectedTeethOnly"].ToString());
				chartView.OrionStatusFlags = (OrionStatus)PIn.Int(table.Rows[i]["OrionStatusFlags"].ToString());
				chartView.DatesShowing     = (ChartViewDates)PIn.Int(table.Rows[i]["DatesShowing"].ToString());
				retVal.Add(chartView);
			}
			return retVal;
		}
Exemplo n.º 7
0
        public void Add()
        {
            var chart = new Chart();

            var lineSeries = chart.NewLineSeries();

            lineSeries.DataSource = new ArrayList
                                        {
                                            new {X = 1, Y = 1},
                                            new {X = 2, Y = 3},
                                            new {X = 3, Y = 2},
                                            new {X = 4, Y = 4}
                                        };
            lineSeries.XValuesDataMember = "X";
            lineSeries.YValuesDataMember = "Y";

            chart.Series.Add(lineSeries);
            chartView = new ChartView { Chart = chart };
            chartView.NewSelectPointTool();
            //chartView.NewAddPointTool();
            WindowsFormsTestHelper.ShowModal(chartView);
        }      
Exemplo n.º 8
0
        public void ChartWithFunctionAsSeriesSource()
        {
            // create function

            var fn = new Function();
            var x = new Variable<double>("x");
            var y = new Variable<double>("y");
            fn.Arguments.Add(x);
            fn.Components.Add(y);

            fn[2.5] = 33.3;
            fn[0.5] = 13.3;
            fn[1.5] = 4.0;

            var chartView1 = new ChartView();// { Data = chart };

            // create chart and add function as a data source using object adapter class FunctionSeriesDataSource
            // var chart = new Chart();

            ILineChartSeries series = ChartSeriesFactory.CreateLineSeries();
            series.DataSource = new FunctionBindingList(fn) { SynchronizeInvoke = chartView1};
            series.XValuesDataMember = x.DisplayName;
            series.YValuesDataMember = y.DisplayName;

            //chart.Series.Add(series);

            // TODO: add asserts
            // TODO: make all windows forms public from WindowsFormsTest which shows and hides forms on build server
            
            // show form
            chartView1.Chart.Series.Add(series);

            // set colors afterwards. TChart changes colors when adding a series to ChartView
            series.LinePenColor = Color.Black;

            //var form = new Form {Width = 600, Height = 100};
            //form.Controls.Add(chartView1);
            WindowsFormsTestHelper.ShowModal(chartView1);
        }
Exemplo n.º 9
0
        public static void Chart(Grid grid, int px, int py, int sx, int sy, string header, JObject data)
        {
            Microsoft.AppCenter.Analytics.Analytics.TrackEvent("Create Chart Widget");
            CrossLogger.Current.Debug("Chart", "Creating Chart Widget");

            try
            {
                Models.Sitemap.Widget3 item = data.ToObject <Models.Sitemap.Widget3>();
                //List<Models.Sitemap.Widget3> items = data.ToObject<List<Models.Sitemap.Widget3>>();


                #region w_grid
                Grid w_grid = new Grid
                {
                    Padding           = new Thickness(0, 0, 0, 0),
                    RowSpacing        = 0,
                    ColumnSpacing     = 0,
                    BackgroundColor   = App.Config.CellColor,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    RowDefinitions    = new RowDefinitionCollection
                    {
                        new RowDefinition {
                            Height = new GridLength(1, GridUnitType.Star)
                        },
                        new RowDefinition {
                            Height = GridLength.Auto
                        },
                    },
                    ColumnDefinitions = new ColumnDefinitionCollection
                    {
                        new ColumnDefinition {
                            Width = new GridLength(1, GridUnitType.Star)
                        },
                    },
                };
                grid.Children.Add(w_grid, px, px + sx, py, py + sy);
                #endregion w_grid


                List <Entry> entries = new List <Entry>
                {
                    new Entry(200)
                    {
                        Label      = "January",
                        ValueLabel = "200",
                        Color      = SKColor.Parse("#266489")
                    },
                    new Entry(400)
                    {
                        Label      = "February",
                        ValueLabel = "400",
                        Color      = SKColor.Parse("#68B9C0")
                    },
                    new Entry(-100)
                    {
                        Label      = "March",
                        ValueLabel = "-100",
                        Color      = SKColor.Parse("#90D585")
                    }
                };
                var cv = new ChartView();
                cv.Chart = new BarChart()
                {
                    Entries = entries
                };

                // or: var chart = new PointChart() { Entries = entries };
                // or: var chart = new LineChart() { Entries = entries };
                // or: var chart = new DonutChart() { Entries = entries };
                // or: var chart = new RadialGaugeChart() { Entries = entries };
                // or: var chart = new RadarChart() { Entries = entries };

                #region Button
                Button dummyButton = new Button
                {
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    BackgroundColor   = Color.Transparent,
                };
                grid.Children.Add(dummyButton, px, px + sx, py, py + sy);
                dummyButton.Clicked += OnDummyButtonClicked;
                #endregion Button
            }
            catch (Exception ex)
            {
                CrossLogger.Current.Error("Chart", "Crashed: " + ex.ToString());
                Error(grid, px, py, 1, 1, ex.ToString());
            }
        }
Exemplo n.º 10
0
        public HorizontalBarChart(ChartView BaseChart)
        {
            bar1           = new HorizBar();
            var            = new Variables.Variables();
            this.BaseChart = BaseChart;

            BaseChart.Chart.Legend.Visible = true;
            BaseChart.Chart.Header.Text    = "Number of Museum Visitors (2008-2011)";
            BaseChart.Chart.Series.Add(bar1);
            //BaseChart.Chart.Series.Add(bar2);

            bar1.Colors = new ColorList {
                var.GetPaletteBasic[0]
            };
            bar1.SeriesColor         = var.GetPaletteBasic[0];
            bar1.Chart.Zoom.Allow    = false;
            bar1.Chart.Panning.Allow = ScrollModes.None;
            bar1.RecalcOptions       = RecalcOptions.OnModify;
            bar1.Title            = "National Gallery";
            bar1.DefaultNullValue = 0;
            for (int i = 0; i < var.GetValorHorizBar1.Length; i++)
            {
                bar1.Add(var.GetValorHorizBar1[i], var.GetValorHorizBarX[i]);
            }
            bar1.MarksOnBar  = true;
            bar1.Marks.Style = MarksStyles.Value;
            bar1.VertAxis    = VerticalAxis.Both;
            bar1.HorizAxis   = HorizontalAxis.Both;

            BaseChart.Chart.Axes.Left.SetMinMax(BaseChart.Chart.Axes.Left.MinYValue, BaseChart.Chart.Axes.Left.MaxYValue);
            BaseChart.Chart.Axes.Bottom.SetMinMax(BaseChart.Chart.Axes.Bottom.MinXValue, BaseChart.Chart.Axes.Bottom.MaxXValue);
            BaseChart.Chart.Axes.Left.Title.Visible        = false;
            BaseChart.Chart.Axes.Bottom.Title.Text         = "Annual Visitors (M)";
            BaseChart.Chart.Axes.Left.Visible              = false;
            BaseChart.Chart.Axes.Bottom.Labels.ValueFormat = "0";
            BaseChart.Chart.Axes.Left.Labels.ValueFormat   = "0";
            BaseChart.Chart.Axes.Bottom.Increment          = 1;
            BaseChart.Chart.Axes.Left.Increment            = 1;
            BaseChart.Chart.Axes.Bottom.Grid.Visible       = true;
            BaseChart.Chart.Legend.Visible     = true;
            BaseChart.Chart.Legend.LegendStyle = LegendStyles.Series;
            BaseChart.Chart.ClickSeries       += null;
            BaseChart.Chart.Axes.Left.Ticks    = new Axis.TicksPen {
                Width = 2, Visible = true, Color = Color.White, EndCap = PenLineCap.Flat, Style = DashStyle.Solid, Length = 10,
            };
            BaseChart.Chart.Axes.Left.Visible         = true;
            BaseChart.Chart.Axes.Left.Labels.Visible  = true;
            BaseChart.Chart.Axes.Bottom.Title.Visible = true;
            BaseChart.Chart.Axes.Left.Labels.Angle    = 0;

            BaseChart.Chart.Axes.Left.AxisPen.Visible = true;
            BaseChart.Chart.Axes.Left.Grid.Visible    = false;
            BaseChart.Chart.Axes.Bottom.Grid.Visible  = false;
            BaseChart.Chart.Panel.MarginLeft          = 5;

            // Themes Marks
            Themes.AplicarMarksTheme1(BaseChart);

            BaseChart.Chart.Series[0].Marks.Font.Size = 14;

            bar1.Marks.Pen.Visible = false;


            BaseChart.Chart.Series[0].Marks.TextAlign = TextAlignment.Center;
            BaseChart.Chart.Series[0].Marks.AutoSize  = true;
            BaseChart.Chart.Series[0].Marks.Color     = Color.Transparent;

            BaseChart.Chart.ClickSeries += null;
        }
        public ZoomPanningChartFeatures(ChartView BaseChart)
        {
            // Variables
            line1                = new Line();
            var                  = new Variables.Variables();
            this.BaseChart       = BaseChart;
            tool_dataPointSelect = new Tools.DataPointSelection(BaseChart);

            // Modificación del "Chart" base
            BaseChart.Chart.ClickSeries   += null;
            BaseChart.Chart.Legend.Visible = true;
            BaseChart.Chart.Panning.Allow  = ScrollModes.Both;
            BaseChart.Chart.Panning.Active = true;
            BaseChart.Chart.Panning.Chart  = BaseChart.Chart;
            BaseChart.Chart.Zoom.Active    = true;
            BaseChart.Chart.Zoom.Zoomed    = true;
            BaseChart.Chart.Zoom.Allow     = true;
            BaseChart.Chart.Zoom.Chart     = BaseChart.Chart;
            BaseChart.Chart.Header.Text    = "Zoom and Panning a Chart";
            BaseChart.Chart.Series.Add(line1);

            line1.FillSampleValues(30);

            // Propiedades de la "line1"

            line1.LinePen.Width = 6;
            line1.LinePen.Color = var.GetPaletteBasic[0];

            line1.Pointer.Color          = var.GetPaletteBasic[0];
            line1.Pointer.InflateMargins = true;
            line1.Pointer.Visible        = true;
            line1.Pointer.HorizSize      = 11;
            line1.Pointer.VertSize       = 11;
            line1.Pointer.Pen.EndCap     = PenLineCap.Round;
            line1.Pointer.Pen.Color      = Color.White;
            line1.Pointer.Pen.Width      = 5;
            line1.Pointer.Style          = PointerStyles.Sphere;

            line1.SeriesColor      = var.GetPaletteBasic[0];
            line1.ClickTolerance   = 40;
            line1.RecalcOptions    = RecalcOptions.OnModify;
            line1.Title            = "Births";
            line1.DefaultNullValue = 0;
            line1.ClickPointer    += tool_dataPointSelect.PointValue_Click;
            line1.GetSeriesMark   += tool_dataPointSelect.Serie_GetSeriesMark;
            line1.VertAxis         = VerticalAxis.Both;
            line1.HorizAxis        = HorizontalAxis.Both;

            // Características de los ejes del "Chart" base
            BaseChart.Chart.Axes.Left.SetMinMax(BaseChart.Chart.Axes.Left.MinYValue - 50, BaseChart.Chart.Axes.Left.MaxYValue + 50);
            BaseChart.Chart.Axes.Bottom.SetMinMax(BaseChart.Chart.Axes.Bottom.MinXValue + 20, BaseChart.Chart.Axes.Bottom.MaxXValue - 20);
            BaseChart.Chart.Axes.Left.Labels.ValueFormat   = "0";
            BaseChart.Chart.Axes.Bottom.Labels.ValueFormat = "0";
            BaseChart.Chart.Axes.Bottom.Increment          = 1;
            BaseChart.Chart.Axes.Left.Increment            = 10;
            BaseChart.Chart.Axes.Left.Visible         = true;
            BaseChart.Chart.Axes.Left.Title           = null;
            BaseChart.Chart.Axes.Bottom.Title         = null;
            BaseChart.Chart.Axes.Left.AxisPen.Visible = false;
            BaseChart.Chart.Axes.Left.Ticks.Visible   = false;
            BaseChart.Chart.Axes.Left.Grid.Visible    = true;
            BaseChart.Chart.Legend.LegendStyle        = LegendStyles.Series;
            BaseChart.Chart.Legend.Visible            = false;
            BaseChart.Chart.Axes.Bottom.Grid.Visible  = false;
            BaseChart.Chart.Panel.MarginLeft          = 5;

            // Themes Marks
            Themes.AplicarMarksTheme1(BaseChart);
            BaseChart.Chart.Series[0].Marks.Font.Size = 18;
        }
Exemplo n.º 12
0
 ///<summary>Updates one ChartView in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.</summary>
 internal static void Update(ChartView chartView,ChartView oldChartView)
 {
     string command="";
     if(chartView.Description != oldChartView.Description) {
         if(command!=""){ command+=",";}
         command+="Description = '"+POut.String(chartView.Description)+"'";
     }
     if(chartView.ItemOrder != oldChartView.ItemOrder) {
         if(command!=""){ command+=",";}
         command+="ItemOrder = "+POut.Int(chartView.ItemOrder)+"";
     }
     if(chartView.ProcStatuses != oldChartView.ProcStatuses) {
         if(command!=""){ command+=",";}
         command+="ProcStatuses = "+POut.Int   ((int)chartView.ProcStatuses)+"";
     }
     if(chartView.ObjectTypes != oldChartView.ObjectTypes) {
         if(command!=""){ command+=",";}
         command+="ObjectTypes = "+POut.Int   ((int)chartView.ObjectTypes)+"";
     }
     if(chartView.ShowProcNotes != oldChartView.ShowProcNotes) {
         if(command!=""){ command+=",";}
         command+="ShowProcNotes = "+POut.Bool(chartView.ShowProcNotes)+"";
     }
     if(chartView.IsAudit != oldChartView.IsAudit) {
         if(command!=""){ command+=",";}
         command+="IsAudit = "+POut.Bool(chartView.IsAudit)+"";
     }
     if(chartView.SelectedTeethOnly != oldChartView.SelectedTeethOnly) {
         if(command!=""){ command+=",";}
         command+="SelectedTeethOnly = "+POut.Bool(chartView.SelectedTeethOnly)+"";
     }
     if(chartView.OrionStatusFlags != oldChartView.OrionStatusFlags) {
         if(command!=""){ command+=",";}
         command+="OrionStatusFlags = "+POut.Int   ((int)chartView.OrionStatusFlags)+"";
     }
     if(chartView.DatesShowing != oldChartView.DatesShowing) {
         if(command!=""){ command+=",";}
         command+="DatesShowing = "+POut.Int   ((int)chartView.DatesShowing)+"";
     }
     if(command==""){
         return;
     }
     command="UPDATE chartview SET "+command
         +" WHERE ChartViewNum = "+POut.Long(chartView.ChartViewNum);
     Db.NonQ(command);
 }
Exemplo n.º 13
0
 ///<summary>Updates one ChartView in the database.</summary>
 internal static void Update(ChartView chartView)
 {
     string command="UPDATE chartview SET "
         +"Description      = '"+POut.String(chartView.Description)+"', "
         +"ItemOrder        =  "+POut.Int   (chartView.ItemOrder)+", "
         +"ProcStatuses     =  "+POut.Int   ((int)chartView.ProcStatuses)+", "
         +"ObjectTypes      =  "+POut.Int   ((int)chartView.ObjectTypes)+", "
         +"ShowProcNotes    =  "+POut.Bool  (chartView.ShowProcNotes)+", "
         +"IsAudit          =  "+POut.Bool  (chartView.IsAudit)+", "
         +"SelectedTeethOnly=  "+POut.Bool  (chartView.SelectedTeethOnly)+", "
         +"OrionStatusFlags =  "+POut.Int   ((int)chartView.OrionStatusFlags)+", "
         +"DatesShowing     =  "+POut.Int   ((int)chartView.DatesShowing)+" "
         +"WHERE ChartViewNum = "+POut.Long(chartView.ChartViewNum);
     Db.NonQ(command);
 }
Exemplo n.º 14
0
 /// <summary>
 /// Action for select view.
 /// </summary>
 /// <param name="view">enum for view type</param>
 public void Action_SelectView(ChartView view)
 {
     string waitElement = string.Empty;
     switch (view)
     {
         case ChartView.Week:
             this.btnWeek.Click();
             break;
         case ChartView.Month:
             this.btnMonth.Click();
             break;
         case ChartView.Quarter:
             this.btnQuarter.Click();
             break;
         case ChartView.Year:
             this.btnYear.Click();
             break;
         default:
             return;
     }
     WebElementKeeper.WaitingFor_InvisibilityOfElementLocated(this._driver, By.XPath(cst_ProgressBar));
     System.Threading.Thread.Sleep(TimeSpan.FromSeconds(5));
 }
Exemplo n.º 15
0
        public RenkoChart(ChartView BaseChart)
        {
            AuxChartView   = new ChartView();
            candle         = new Candle();
            renko          = new Renko();
            this.BaseChart = BaseChart;

            candle.FillSampleValues(12);

            BaseChart.Chart.Title.Text = "Renko";

            BaseChart.Chart.Axes.Left.AxisPen.Visible = true;
            BaseChart.Chart.Axes.Left.Visible         = true;
            BaseChart.Chart.Axes.Bottom.Visible       = true;
            BaseChart.Chart.Series.Add(renko);
            BaseChart.Chart.Series.Add(candle);

            //renko.Clear();
            for (int i = 0; i < candle.Count; i++)
            {
                renko.Add(candle.CloseValues[i]);
            }

            // box size set to 2
            //renko.BoxSize = 5;
            //renko.Pointer.Style = PointerStyles.Rectangle;
            //renko.Title = "Renko (Close values)";

            candle.Title = "Trading Data";

            candle.HorizAxis = HorizontalAxis.Bottom;
            candle.VertAxis  = VerticalAxis.Left;

            BaseChart.Chart.Axes.Left.Title.Visible    = false;
            BaseChart.Chart.Axes.Bottom.Title.Visible  = false;
            BaseChart.Chart.Axes.Bottom.Labels.Visible = true;
            BaseChart.Chart.Axes.Left.Labels.Visible   = true;

            BaseChart.Chart.Axes.Left.AxisPen.Visible = true;
            BaseChart.Chart.Axes.Bottom.Visible       = true;
            BaseChart.Chart.Axes.Bottom.Ticks.Visible = false;
            BaseChart.Chart.Axes.Left.Increment       = 10;

            BaseChart.Chart.Panel.Left = 0;

            BaseChart.Chart.Axes.Bottom.RelativePosition = 53;
            BaseChart.Chart.Axes.Left.EndPosition        = 47;

            customLeftRenko   = CreateAxis();
            customBottomRenko = CreateAxis();
            //Themes.UpdateAxes(customLeftRenko, customBottomRenko);

            //BaseChart.Chart.Axes.Custom.Add(customLeftRenko);
            //BaseChart.Chart.Axes.Custom.Add(customBottomRenko);

            customLeftRenko.Horizontal         = false;
            customLeftRenko.StartPosition      = 53;
            customLeftRenko.EndPosition        = 100;
            customLeftRenko.Grid               = BaseChart.Chart.Axes.Left.Grid;
            customLeftRenko.AxisPen.Visible    = true;
            customLeftRenko.Increment          = 10;
            customLeftRenko.AxisPen.Color      = customLeftRenko.AxisPen.GetColor().AddLuminosity(-0.2);
            customLeftRenko.Ticks.Transparency = 100;

            customBottomRenko.Horizontal       = true;
            customBottomRenko.StartPosition    = 0;
            customBottomRenko.EndPosition      = 100;
            customBottomRenko.RelativePosition = 0;
            customBottomRenko.AxisPen.Visible  = true;
            customBottomRenko.Ticks.Visible    = false;
            customBottomRenko.AxisPen.Color    = customBottomRenko.AxisPen.GetColor().AddLuminosity(-0.2);

            //renko.HorizAxis = HorizontalAxis.Bottom;
            //renko.VertAxis = VerticalAxis.Custom;
            //renko.CustomHorizAxis = customBottomRenko;
            //renko.CustomVertAxis = customLeftRenko;

            BaseChart.Chart.Axes.Bottom.Automatic        = true;
            BaseChart.Chart.Axes.Bottom.AutomaticMaximum = true;
            BaseChart.Chart.Axes.Bottom.AutomaticMinimum = true;
            BaseChart.Chart.Axes.Left.SetMinMax(BaseChart.Chart.Axes.Left.MinYValue, BaseChart.Chart.Axes.Left.MaxYValue);

            customLeftRenko.SetMinMax(BaseChart.Chart.Axes.Left.MinYValue, BaseChart.Chart.Axes.Left.MaxYValue);
            customBottomRenko.Automatic        = true;
            customBottomRenko.AutomaticMaximum = true;
            customBottomRenko.AutomaticMinimum = true;
        }
Exemplo n.º 16
0
        public void ChartWithObjectsAsSeriesSource()
        {
            IList objects = new ArrayList
                                {
                                    new {X = 2.5, Y = 33.3}, 
                                    new {X = 0.5, Y = 13.3}
                                };

            // create chart and add function as a data source using object adapter class FunctionSeriesDataSource

            IChartSeries series = ChartSeriesFactory.CreateLineSeries();
            series.DataSource = objects;
            series.XValuesDataMember = "X";
            series.YValuesDataMember = "Y";

            var chartView1 = new ChartView();

            chartView1.Chart.Series.Add(series);

            // show form
            var form = new Form {Width = 600, Height = 100};
            form.Controls.Add(chartView1);
            WindowsFormsTestHelper.ShowModal(form);
        }
        public PolarChart(ChartView BaseChart)
        {
            this.BaseChart = BaseChart;
            polar1         = new Polar();
            polar2         = new Polar();
            var            = new Variables.Variables();

            for (int i = 0; i < var.GetValorPolar1.Length / 2; i++)
            {
                polar1.Add(var.GetValorPolar1[i, 0], var.GetValorPolar1[i, 1]);
            }
            for (int i = 0; i < var.GetValorPolar2.Length / 2; i++)
            {
                polar2.Add(var.GetValorPolar2[i, 0], var.GetValorPolar2[i, 1]);
            }

            polar1.Color              = var.GetPaletteBasic[0];
            polar2.Color              = var.GetPaletteBasic[1];
            polar1.Circled            = true;
            polar2.Circled            = true;
            polar1.CloseCircle        = true;
            polar2.CloseCircle        = true;
            polar1.Pen.Color          = Color.White;
            polar2.Pen.Color          = Color.White;
            polar1.CircleLabels       = true;
            polar1.CircleLabelsInside = false;
            polar2.CircleLabels       = true;
            polar2.CircleLabelsInside = false;

            BaseChart.Chart.Series.Add(polar1);
            BaseChart.Chart.Series.Add(polar2);

            BaseChart.Chart.Title.Text        = "Polar";
            BaseChart.Chart.Axes.Left.Visible = true;
            BaseChart.Chart.Axes.Left.MinorTicks.Transparency   = 100;
            BaseChart.Chart.Axes.Bottom.MinorTicks.Transparency = 100;
            BaseChart.Chart.Axes.Left.SetMinMax(BaseChart.Chart.Axes.Left.MinYValue - 100, BaseChart.Chart.Axes.Left.MaxYValue + 100);
            BaseChart.Chart.Axes.Bottom.SetMinMax(BaseChart.Chart.Axes.Bottom.MinYValue - 100, BaseChart.Chart.Axes.Bottom.MaxXValue + 100);

            BaseChart.Chart.Axes.Bottom.Automatic          = true;
            BaseChart.Chart.Axes.Left.Labels.ValueFormat   = "0";
            BaseChart.Chart.Axes.Bottom.Labels.ValueFormat = "0";
            BaseChart.Chart.Axes.Bottom.Increment          = 1;
            BaseChart.Chart.Axes.Left.Increment            = 100;
            BaseChart.Chart.Axes.Left.Visible           = true;
            BaseChart.Chart.Axes.Left.Title             = null;
            BaseChart.Chart.Axes.Bottom.Title           = null;
            BaseChart.Chart.Axes.Left.AxisPen.Visible   = false;
            BaseChart.Chart.Axes.Left.Ticks.Visible     = false;
            BaseChart.Chart.Axes.Left.Grid.Visible      = true;
            BaseChart.Chart.Legend.LegendStyle          = LegendStyles.Series;
            BaseChart.Chart.Axes.Bottom.Grid.Visible    = false;
            BaseChart.Chart.Panel.MarginLeft            = 5;
            BaseChart.Chart.Axes.Bottom.AxisPen.Visible = true;
            BaseChart.Chart.Axes.Bottom.Visible         = true;
            BaseChart.Chart.Axes.Left.Increment         = 100;

            polar1.AngleIncrement         = 30;
            polar2.AngleIncrement         = 30;
            polar1.CircleLabelsFont.Size += 2;
            polar2.CircleLabelsFont.Size += 2;
            polar1.RadiusIncrement        = 300;
            polar2.RadiusIncrement        = 300;
        }
        // Constructor del "LineChart"
        public HorizontalLineChart(ChartView BaseChart)
        {
            // Variables
            line1                = new HorizLine();
            line2                = new HorizLine();
            var                  = new Variables.Variables();
            this.BaseChart       = BaseChart;
            tool_dataPointSelect = new DataPointSelection(BaseChart);

            // Modificación del "Chart" base
            BaseChart.Chart.ClickSeries   += null;
            BaseChart.Chart.Legend.Visible = true;
            BaseChart.Chart.Header.Text    = "Bear population in two forests";
            BaseChart.Chart.Series.Add(line1);
            BaseChart.Chart.Series.Add(line2);

            line1.Add(var.GetValorHorizLine1, var.GetValorHorizLineY, true);
            line2.Add(var.GetValorHorizLine2, var.GetValorHorizLineY, true);

            // Propiedades de la "line1"

            line1.LinePen.Width = 6;
            line1.LinePen.Color = var.GetPaletteBasic[0];

            line1.Pointer.Color          = var.GetPaletteBasic[0];
            line1.Pointer.InflateMargins = true;
            line1.Pointer.Visible        = true;
            line1.Pointer.HorizSize      = 11;
            line1.Pointer.VertSize       = 11;
            line1.Pointer.Pen.EndCap     = PenLineCap.Round;
            line1.Pointer.Pen.Color      = Color.White;
            line1.Pointer.Pen.Width      = 5;
            line1.Pointer.Style          = PointerStyles.Sphere;

            line1.SeriesColor         = var.GetPaletteBasic[0];
            line1.Chart.Zoom.Allow    = false;
            line1.Chart.Panning.Allow = ScrollModes.None;
            line1.LineHeight          = 25;
            line1.ClickableLine       = true;
            line1.ClickPointer       += tool_dataPointSelect.PointValue_Click;
            line1.GetSeriesMark      += tool_dataPointSelect.Serie_GetSeriesMark;
            line1.ClickTolerance      = 40;
            line1.RecalcOptions       = RecalcOptions.OnModify;
            line1.Title            = "Forest 1";
            line1.DefaultNullValue = 0;
            line1.VertAxis         = VerticalAxis.Both;
            line1.HorizAxis        = HorizontalAxis.Both;

            // Propiedades de la "line2"
            line2.LinePen = new ChartPen {
                Width = 6, Color = var.GetPaletteBasic[1],
            };
            line2.Pointer = new SeriesPointer(BaseChart.Chart, line2)
            {
                Color = var.GetPaletteBasic[1], InflateMargins = true, HorizSize = 11, VertSize = 11, Pen = new ChartPen {
                    EndCap = PenLineCap.Round, Color = Xamarin.Forms.Color.White, Width = 5
                }, Style = PointerStyles.Sphere
            };
            line2.SeriesColor         = var.GetPaletteBasic[1];
            line2.Chart.Zoom.Allow    = false;
            line2.Chart.Panning.Allow = ScrollModes.None;
            line2.LineHeight          = 25;
            line2.ClickableLine       = true;
            line2.ClickPointer       += tool_dataPointSelect.PointValue_Click;
            line2.GetSeriesMark      += tool_dataPointSelect.Serie_GetSeriesMark;
            line2.ClickTolerance      = 40;
            line2.RecalcOptions       = RecalcOptions.OnModify;
            line2.Title     = "Forest 2";
            line2.VertAxis  = VerticalAxis.Both;
            line2.HorizAxis = HorizontalAxis.Both;

            // Características de los ejes del "Chart" base
            BaseChart.Chart.Axes.Left.SetMinMax(BaseChart.Chart.Axes.Left.MinYValue, BaseChart.Chart.Axes.Left.MaxYValue);
            BaseChart.Chart.Axes.Bottom.SetMinMax(BaseChart.Chart.Axes.Bottom.MinXValue, BaseChart.Chart.Axes.Bottom.MaxXValue);
            BaseChart.Chart.Axes.Left.Labels.ValueFormat   = "0";
            BaseChart.Chart.Axes.Bottom.Labels.ValueFormat = "0";
            BaseChart.Chart.Axes.Bottom.Increment          = 20;
            BaseChart.Chart.Axes.Left.Increment            = 1;
            BaseChart.Chart.Axes.Left.Visible         = true;
            BaseChart.Chart.Axes.Left.Title           = null;
            BaseChart.Chart.Axes.Bottom.Title         = null;
            BaseChart.Chart.Axes.Left.AxisPen.Visible = false;
            BaseChart.Chart.Axes.Left.Ticks.Visible   = false;
            BaseChart.Chart.Axes.Left.Grid.Visible    = true;
            BaseChart.Chart.Legend.LegendStyle        = LegendStyles.Series;
            BaseChart.Chart.Axes.Bottom.Grid.Visible  = false;
            BaseChart.Chart.Panel.MarginLeft          = 5;


            // Themes Marks
            Themes.AplicarMarksTheme1(BaseChart);
            line1.Marks.Font.Size = 18;
            line2.Marks.Font.Size = 18;
            line1.Marks.TailParams.PointerWidth  = 0;
            line1.Marks.Arrow.Visible            = false;
            line2.Marks.TailParams.PointerWidth  = 0;
            line2.Marks.Arrow.Visible            = false;
            line1.Marks.ArrowLength              = 0;
            line2.Marks.ArrowLength              = 0;
            line1.Marks.TailParams.PointerHeight = 0;
            line2.Marks.TailParams.PointerHeight = 0;
        }
        public FLineRealTimeChartFeatures(ChartView BaseChart)
        {
            fastLine1      = new FastLine();
            fastLine2      = new FastLine();
            var            = new Variables.Variables();
            this.BaseChart = BaseChart;
            pointsCreate   = 0;

            BaseChart.Chart.Header.Text = "Fast random picture";
            BaseChart.Chart.Series.Add(fastLine1);
            BaseChart.Chart.Series.Add(fastLine2);
            BaseChart.Chart.Legend.Visible = false;

            fastLine1.SeriesColor         = var.GetPaletteBasic[0];
            fastLine1.Chart.Zoom.Allow    = false;
            fastLine1.Chart.Panning.Allow = ScrollModes.None;

            fastLine1.RecalcOptions    = RecalcOptions.OnModify;
            fastLine1.DefaultNullValue = 0;
            fastLine1.AutoRepaint      = true;
            fastLine1.VertAxis         = VerticalAxis.Both;
            fastLine1.HorizAxis        = HorizontalAxis.Both;

            fastLine2.SeriesColor         = var.GetPaletteBasic[var.GetPaletteBasic.Length - 1];
            fastLine2.Chart.Zoom.Allow    = false;
            fastLine2.Chart.Panning.Allow = ScrollModes.None;

            fastLine2.RecalcOptions    = RecalcOptions.OnModify;
            fastLine2.DefaultNullValue = 0;
            fastLine2.AutoRepaint      = true;
            fastLine2.VertAxis         = VerticalAxis.Both;
            fastLine2.HorizAxis        = HorizontalAxis.Both;

            Random r = new Random();
            int    tmprandom;

            for (int t = 1; t < 1000; t++)
            {
                tmprandom = r.Next(Math.Abs(500 - t)) - (Math.Abs(500 - t) / 2);
                fastLine1.Add(1000 - t + tmprandom);
                fastLine2.Add(t + tmprandom);
            }

            BaseChart.Chart.Axes.Left.SetMinMax(BaseChart.Chart.Axes.Left.MinYValue - 100, BaseChart.Chart.Axes.Left.MaxYValue + 100);
            BaseChart.Chart.Axes.Bottom.SetMinMax(0, BaseChart.Chart.Axes.Bottom.MaxXValue + 3);

            BaseChart.Chart.Axes.Bottom.Increment = 5;
            BaseChart.Chart.Axes.Left.Increment   = 15;

            BaseChart.Chart.Axes.Left.Labels.ValueFormat   = "0K";
            BaseChart.Chart.Axes.Bottom.Labels.ValueFormat = "0";
            BaseChart.Chart.Axes.Left.Title.Pen            = new ChartPen {
                Color = Xamarin.Forms.Color.Black, Width = 15
            };

            BaseChart.Chart.Axes.Left.Title.Visible   = false;
            BaseChart.Chart.Axes.Bottom.Title.Visible = false;

            BaseChart.Chart.Axes.Left.Visible         = true;
            BaseChart.Chart.Axes.Left.AxisPen.Visible = true;
            BaseChart.Chart.Axes.Left.Ticks           = new Axis.TicksPen {
                Width = 2, Visible = true, Color = Xamarin.Forms.Color.FromRgb(200, 200, 200), EndCap = PenLineCap.Flat, Style = DashStyle.Solid, Length = 10,
            };
            BaseChart.Chart.Axes.Bottom.Visible = true;

            BaseChart.Chart.Axes.Left.Title.Angle  = 90;
            BaseChart.Chart.Axes.Left.Grid.Visible = false;
            BaseChart.Chart.ClickSeries           += null;

            BaseChart.Chart.Panel.MarginLeft = 5;
            BaseChart.Chart.AfterDraw       += Chart_AfterDraw;

            // Themes Marks
            Themes.AplicarMarksTheme1(BaseChart);
        }
Exemplo n.º 20
0
 private void HideLegendMenuItem_Click(object sender, EventArgs e)
 {
     ChartView.ShowLegend = false;
     ChartView.ConfigureRenderingControl();
 }
Exemplo n.º 21
0
 internal void ResetZoomMenuItem_Click(object sender, EventArgs e)
 {
     ActivateZooming();
     ChartView.ScaleView(100);
 }
Exemplo n.º 22
0
/// <summary>
/// Show axis titles
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>

        internal void ShowAxisTitlesMenuItem_Click(object sender, EventArgs e)
        {
            ChartView.ShowAxesTitles = !ChartView.ShowAxesTitles;
            ChartView.ConfigureRenderingControl();
        }