コード例 #1
0
    public void SerializeObject()
    {
        Bar bar0 = new Bar();

        bar0.Add(new Bar()
        {
            Name = "Bar1"
        });
        bar0.Add(new Bar()
        {
            Name = "Bar2"
        });
        Bar bar3 = new Bar()
        {
            Name = "Bar3"
        };

        bar3.Add(new Bar()
        {
            Name = "Child0 To bar3"
        });
        bar3.Add(new Bar()
        {
            Name = "Child1 To bar3"
        });

        bar0.Add(bar3);
        var x = new XmlSerializer(bar0.GetType());

        x.Serialize(Console.Out, bar0);
        Console.ReadLine();
    }
コード例 #2
0
ファイル: BasesTest.cs プロジェクト: linearregression/C5
            public void UnseqequalityComparerViaBuilder4()
            {
                SCG.IEqualityComparer <IBar> h = C5.EqualityComparer <IBar> .Default;
                IBar s = new Bar();

                s.Add(1); s.Add(2); s.Add(3);
                Assert.AreEqual(CHC.unsequencedhashcode(1, 2, 3), h.GetHashCode(s));
            }
コード例 #3
0
 private void BtnPreview_Period_Click(object sender, EventArgs e)
 {
     Tchart_DayOfWeek.Hide();
     Tchart_Period.Show();
     if (PeriodConf.CommonBandpassList.Count > 0)
     {
         Tchart_Period.Series.Clear();
         Tchart_Period.Axes.Left.AutomaticMaximum = PeriodConf.AutoScale;
         if (!PeriodConf.AutoScale)
         {
             Tchart_Period.Axes.Left.Maximum = PeriodConf.MaxScale;
         }
         Tchart_Period.Header.Lines = new string[] { PeriodConf.SelectedBandpass.OverrideInfo.OverrideName };
         foreach (DataTable table in DBConn.LoadPeriodData(PeriodConf))
         {
             Bar barSeries = new Bar()
             {
                 Title = table.TableName
             };
             barSeries.Marks.Visible = false;
             Tchart_Period.Series.Add(barSeries);
             foreach (DataRow data in table.Rows)
             {
                 barSeries.Add(Convert.ToDouble(data.ItemArray[2]), data.ItemArray[0].ToString() + "\n" + data.ItemArray[1].ToString());
             }
         }
     }
 }
コード例 #4
0
        public AvgStdFunctionsChart(ChartView BaseChart)
        {
            avgFunction = new Steema.TeeChart.Functions.Average();
            bar1        = new Bar();
            theAvgLine  = new Line();
            var         = new Variables.Variables();

            for (int i = 0; i < var.GetValorStdAvg1.Length; i++)
            {
                bar1.Add(i, var.GetValorStdAvg1[i]);
            }

            BaseChart.Chart.Series.Add(bar1);
            BaseChart.Chart.Series.Add(theAvgLine);

            theAvgLine.Function   = avgFunction;
            theAvgLine.DataSource = new object[] { bar1 };

            bar1.SeriesColor       = var.GetPaletteBasic[0];
            theAvgLine.SeriesColor = var.GetPaletteBasic[2];

            bar1.Title         = "Data";
            bar1.MarksOnBar    = true;
            bar1.MarksLocation = MarksLocation.Start;

            theAvgLine.Title                  = "Average";
            theAvgLine.LinePen.Width          = 6;
            theAvgLine.Pointer.Style          = PointerStyles.Sphere;
            theAvgLine.Pointer.InflateMargins = true;
            theAvgLine.Pointer.HorizSize      = 5;
            theAvgLine.Pointer.VertSize       = 5;
            theAvgLine.Pointer.Visible        = true;
            theAvgLine.Marks.Visible          = true;
            theAvgLine.Marks.DrawEvery        = 2;

            BaseChart.Chart.Axes.Left.SetMinMax(BaseChart.Chart.Axes.Left.MinYValue + 1.6, BaseChart.Chart.Axes.Left.MaxYValue + 2);
            BaseChart.Chart.Axes.Bottom.SetMinMax(BaseChart.Chart.Axes.Bottom.MinXValue, BaseChart.Chart.Axes.Bottom.MaxXValue);
            BaseChart.Chart.Axes.Left.Increment        = 20;
            BaseChart.Chart.Axes.Bottom.Labels.Visible = false;
            BaseChart.Chart.Axes.Left.Grid.Visible     = false;
            BaseChart.Chart.Axes.Left.AxisPen.Visible  = true;
            BaseChart.Chart.Header.Visible             = false;

            theAvgLine.Marks.AutoSize          = true;
            theAvgLine.Marks.FollowSeriesColor = true;
            theAvgLine.Marks.Pen.Width         = 1;
            theAvgLine.Marks.Pen.Color         = theAvgLine.Color.AddLuminosity(-0.3);
            theAvgLine.Marks.Font.Size         = 13;

            bar1.Marks.Font.Size   = 14;
            bar1.Marks.Pen.Visible = false;
            bar1.Marks.TailStyle   = MarksTail.None;
            bar1.Marks.TextAlign   = TextAlignment.Center;
            bar1.Marks.AutoSize    = true;
            bar1.Marks.BackColor   = Color.Transparent;
            bar1.Marks.Font.Color  = Color.White;
            bar1.Marks.TailStyle   = MarksTail.None;

            BaseChart.Chart.Panel.MarginLeft = 5;
        }
コード例 #5
0
        public DocumentWorkView()
        {
            actualParam = new QParam(LogicType.And, DocumentWork.DBTable.ParseProperty(nameof(DocumentWork.DateComplete)), CompareType.Is, null);

            view.ApplySortInternal(new DBComparer <DocumentWork, long?>(DocumentWork.DBTable.PrimaryKey));
            view.Query.Parameters.Add(actualParam);

            list.AllowSort = false;
            Name           = nameof(DocumentWorkView);
            Text           = "Works";

            toolActual = new ToolItem(ToolActualClick)
            {
                Name = "Actual", Checked = true, CheckOnClick = true, GlyphColor = Colors.Green, Glyph = GlyphType.CheckCircleO
            };

            Bar.Add(toolActual);
            //list.ListInfo = new LayoutListInfo(
            //    new LayoutColumn() { Name = "ToString", FillWidth = true },
            //    new LayoutColumn() { Name = "Date", Width = 115 },
            //    new LayoutColumn() { Name = "IsComplete", Width = 20 })
            //{
            //    ColumnsVisible = false,
            //    HeaderVisible = false
            //};
        }
コード例 #6
0
        // Methods
        public DataGraphicsElement()
        {
            this.m_pSelectionTracker             = new EnvelopeTracker();
            this.m_pSelectionTracker.Locked      = false;
            this.m_pSelectionTracker.ShowHandles = true;
            this.m_pGeometry = new Envelope() as IEnvelope;
            this.m_pGeometry.PutCoords(4.0, 4.0, 18.5, 16.4);
            this.m_pFillSymbol1 = new SimpleFillSymbol();
            (this.m_pFillSymbol1 as ISimpleFillSymbol).Style = esriSimpleFillStyle.esriSFSNull;
            this.m_chart.Header.Text = "实例";
            Series s = new Bar
            {
                Title = "实例1"
            };

            s.Add(new List <double> {
                30.0, 50.0, 60.0, 80.0
            });
            this.m_chart.Series.Add(s);
            s = new Bar
            {
                Title = "实例1"
            };
            s.Add(new List <double> {
                20.0, 50.0, 20.0, 60.0
            });
            this.m_chart.Series.Add(s);
        }
コード例 #7
0
        public HighStdFunctionsChart(ChartView BaseChart)
        {
            highFunction = new Steema.TeeChart.Functions.High();
            bar1         = new Bar();
            theHighLine  = new Line();
            var          = new Variables.Variables();

            for (int i = 0; i < var.GetValorStdHigh1.Length; i++)
            {
                bar1.Add(i, var.GetValorStdHigh1[i]);
            }

            BaseChart.Chart.Series.Add(bar1);
            BaseChart.Chart.Series.Add(theHighLine);

            theHighLine.Function   = highFunction;
            theHighLine.DataSource = new object[] { bar1 };

            bar1.SeriesColor        = var.GetPaletteBasic[0];
            theHighLine.SeriesColor = var.GetPaletteBasic[2];

            bar1.Title         = "Data";
            bar1.MarksOnBar    = true;
            bar1.MarksLocation = MarksLocation.Start;

            theHighLine.Title                  = "High";
            theHighLine.LinePen.Width          = 6;
            theHighLine.Pointer.Style          = PointerStyles.Sphere;
            theHighLine.Pointer.InflateMargins = true;
            theHighLine.Pointer.HorizSize      = 5;
            theHighLine.Pointer.VertSize       = 5;
            theHighLine.Pointer.Visible        = true;
            theHighLine.Marks.Visible          = true;
            theHighLine.Marks.DrawEvery        = 2;

            BaseChart.Chart.Axes.Left.SetMinMax(BaseChart.Chart.Axes.Left.MinYValue + 0.23, BaseChart.Chart.Axes.Left.MaxYValue + 2);
            BaseChart.Chart.Axes.Bottom.SetMinMax(BaseChart.Chart.Axes.Bottom.MinXValue, BaseChart.Chart.Axes.Bottom.MaxXValue);
            BaseChart.Chart.Axes.Left.Increment        = 5;
            BaseChart.Chart.Axes.Bottom.Labels.Visible = false;
            BaseChart.Chart.Axes.Left.Grid.Visible     = false;
            BaseChart.Chart.Axes.Left.AxisPen.Visible  = true;
            BaseChart.Chart.Header.Visible             = false;

            Themes.AplicarMarksTheme1(BaseChart);
            BaseChart.Chart.Series[0].Marks.Font.Size = 14;
            BaseChart.Chart.Series[1].Marks.Font.Size = 14;

            bar1.Marks.Pen.Visible = false;

            bar1.Marks.TailStyle = MarksTail.None;

            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.Series[1].Marks.TailStyle = MarksTail.None;
            BaseChart.Chart.Panel.MarginLeft          = 5;

            ImplementiOSMarks(BaseChart.Chart);
        }
コード例 #8
0
        private void MinTemperatureForecast(ActualWeather weather)
        {
            Chart tChart1 = new Chart();

            tChart1.Axes.Left.Increment               = 1;
            tChart1.Axes.Bottom.Labels.Angle          = 90;
            tChart1.Axes.Bottom.Labels.DateTimeFormat = "dd/MMM";
            tChart1.Axes.Bottom.Labels.Font.Size      = 15;
            tChart1.Axes.Bottom.Ticks.Length          = 15;
            tChart1.Axes.Bottom.Ticks.Visible         = true;
            tChart1.Axes.Bottom.Labels.Color          = Color.Aqua;
            tChart1.Axes.Left.Labels.Color            = Color.Aqua;
            tChart1.Axes.Left.Labels.Font.Size        = 15;
            tChart1.Axes.Left.Ticks.Visible           = true;
            tChart1.Axes.Left.Ticks.Length            = 15;
            tChart1.Axes.Left.MinorTicks.Visible      = false;
            tChart1.Aspect.ColorPaletteIndex          = 20;
            tChart1.Header.Visible              = false;
            tChart1.Aspect.View3D               = false;
            tChart1.Panel.Pen.Visible           = true;
            tChart1.Walls.Back.Brush.Visible    = true;
            tChart1.Walls.Back.Transparent      = false;
            tChart1.Walls.Back.Gradient.Visible = false;
            tChart1.Walls.Back.Color            = Color.White;
            tChart1.Panel.Gradient.Visible      = false;
            tChart1.Panel.Color        = Color.FromHex("#00007F");
            tChart1.Panning.Allow      = ScrollModes.None;
            tChart1.Legend.Visible     = false;
            tChart1.Panel.Visible      = false;
            tChart1.Panel.MarginBottom = 5;
            tChart1.Panel.MarginLeft   = 5;
            tChart1.Panel.MarginRight  = 5;
            tChart1.Panel.MarginTop    = 5;

            var minTemp = new Bar(tChart1.Chart);

            minTemp.Marks.Visible = false;
            double max = weather.LstWeather[0].MinTemperature;
            double min = weather.LstWeather[0].MinTemperature;

            foreach (var item in weather.LstWeather)
            {
                if (item.MinTemperature > max)
                {
                    max = item.MinTemperature;
                }
                if (item.MinTemperature < min)
                {
                    min = item.MinTemperature;
                }
                minTemp.Add(item.Date, item.Temperature);
            }

            tChart1.Axes.Left.SetMinMax((int)min - 5, (int)max + 5);
            ShowChart(tChart1);
        }
コード例 #9
0
        public override async Task LoadPlots()
        {
            chart.Series.Clear();

            foreach (var trait in traits)
            {
                if (!charts.Tables.Contains($"{Treatment}_{trait}"))
                {
                    var query = new MetDataQuery {
                        TreatmentId = Treatment, TraitName = trait
                    };
                    charts.Tables.Add(await QueryManager.Request(query));
                }

                var table = charts.Tables[$"{Treatment}_{trait}"];

                var rows = table.Rows.Cast <DataRow>();

                if (!rows.Any())
                {
                    continue;
                }

                var pairs = rows.Select(r => (Convert.ToDateTime(r["Date"]), (double)r["Mean"]));

                var b = new Bar();
                var l = new Line(chart);

                b.XValues.DateTime = true;
                l.XValues.DateTime = true;
                b.Marks.Visible    = false;
                b.CustomBarWidth   = 3;

                b.Color = l.Color = Colours.Lookup(trait).colour;

                foreach (var pair in pairs)
                {
                    b.Add(pair.Item1, pair.Item2);
                    l.Add(pair.Item1, pair.Item2);
                }

                l.Legend.Text    = trait;
                b.Legend.Visible = false;

                //chart.Series.Add(b);
                chart.Series.Add(l);
            }

            chart.Axes.Bottom.Title.Text = "Date";
            chart.Axes.Left.Title.Text   = "Value";
            chart.Legend.Title.Text      = descriptions[0]?.WordWrap(18) ?? "";

            chart.Legend.Width = 120;

            chart.Header.Text = "Average annual weather data";
        }
コード例 #10
0
        public AddStdFunctionsChart(ChartView BaseChart)
        {
            addFunction = new Steema.TeeChart.Functions.Add();
            bar         = new Bar();
            theAddLine  = new Line();
            var         = new Variables.Variables();

            BaseChart.Chart.Series.Add(bar);
            BaseChart.Chart.Series.Add(theAddLine);

            bar.Title                = "Data";
            bar.SeriesColor          = var.GetPaletteBasic[0];
            theAddLine.Title         = "Add";
            theAddLine.LinePen.Width = 6;
            theAddLine.Color         = var.GetPaletteBasic[2];

            for (int i = 0; i < var.GetValorStdAdd1.Length; i++)
            {
                bar.Add(i, var.GetValorStdAdd1[i]);
            }

            theAddLine.Function   = addFunction;
            theAddLine.DataSource = bar;

            BaseChart.Chart.Axes.Left.SetMinMax(BaseChart.Chart.Axes.Left.MinYValue, BaseChart.Chart.Axes.Left.MaxYValue + 100);
            BaseChart.Chart.Axes.Bottom.SetMinMax(BaseChart.Chart.Axes.Bottom.MinXValue, BaseChart.Chart.Axes.Bottom.MaxXValue);
            BaseChart.Chart.Axes.Left.Increment        = 500;
            BaseChart.Chart.Axes.Bottom.Labels.Visible = false;
            BaseChart.Chart.Axes.Left.Grid.Visible     = false;
            BaseChart.Chart.Axes.Left.AxisPen.Visible  = true;
            BaseChart.Chart.Header.Visible             = false;

            Themes.AplicarMarksTheme1(BaseChart);
            theAddLine.Marks.Visible   = true;
            theAddLine.Marks.Width    += 40;
            theAddLine.Marks.DrawEvery = 2;

            ImplementiOSMarks(BaseChart.Chart);
        }
コード例 #11
0
        private void AddBar(TChart tChart1, Bar tmp_bar, double[] tmp_Yvalue, double[] XValue)
        {
            tChart1.Aspect.View3D          = false;
            tmp_bar.Marks.Gradient.Visible = true;
            tmp_bar.Marks.Visible          = false;                          //标签卡不显示

            tmp_bar.Marks.Gradient.StartColor = Color.FromArgb(255, 215, 0); //网格颜色设置
            tmp_bar.Marks.Gradient.EndColor   = Color.White;
            tmp_bar.Marks.Symbol.Visible      = true;

            tmp_bar.Add(XValue, tmp_Yvalue);
            tChart1.Axes.Left.Minimum     = getMin(tmp_Yvalue) - 1;
            tChart1.Axes.Left.Maximum     = getMax(tmp_Yvalue) + 1;
            tChart1.Axes.Left.Increment   = 0; //纵坐标增量
            tChart1.Page.MaxPointsPerPage = 0;
            tChart1.Axes.Bottom.Increment = 0; //横坐标增量

            int len = XValue.Length;

            tChart1.Axes.Bottom.SetMinMax(XValue[0], XValue[len - 1]);
            tChart1.Refresh();
        }
コード例 #12
0
        public SalesFigures()
        {
            tChart1 = new Chart();
            tChart1.Aspect.View3D   = false;
            tChart1.Zoom.Active     = true;
            tChart1.Aspect.ZoomText = true;
            tChart1.Panning.Active  = true;

            this.bar1                = new Bar();
            this.bar2                = new Bar();
            this.seriesAnimation1    = new Steema.TeeChart.Tools.SeriesAnimation();
            this.chartPartAnimation1 = new Steema.TeeChart.Animations.ChartPartAnimation();
            this.tChart1.Animations.Add(this.chartPartAnimation1);
            this.tChart1.Aspect.ColorPaletteIndex            = 20;
            this.tChart1.Aspect.View3D                       = false;
            this.tChart1.Axes.Bottom.Grid.DrawEvery          = 2;
            this.tChart1.Axes.Bottom.Grid.Visible            = false;
            this.tChart1.Axes.Bottom.Labels.Font.Brush.Color = Color.FromRgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
            this.tChart1.Axes.Bottom.Labels.Font.Size        = 9;
            this.tChart1.Axes.Bottom.Title.Font.Brush.Color  = Color.FromRgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
            this.tChart1.Axes.Bottom.Title.Font.Size         = 11;
            this.tChart1.Axes.Left.AxisPen.Visible           = false;
            this.tChart1.Axes.Left.Grid.DrawEvery            = 2;
            this.tChart1.Axes.Left.Grid.Style                = Steema.TeeChart.Drawing.DashStyle.Solid;
            this.tChart1.Axes.Left.Labels.Font.Brush.Color   = Color.Gray;
            this.tChart1.Axes.Left.Labels.Font.Size          = 9;
            this.tChart1.Axes.Left.MinorTicks.Visible        = false;
            this.tChart1.Axes.Left.Ticks.Visible             = false;
            this.tChart1.Axes.Left.Title.Caption             = "$ 000s";
            this.tChart1.Axes.Left.Title.Font.Brush.Color    = Color.FromRgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
            this.tChart1.Axes.Left.Title.Font.Size           = 11;
            this.tChart1.Axes.Left.Title.Lines               = new string[] { "$ 000s" };
            this.tChart1.Axes.Right.AxisPen.Visible          = false;
            this.tChart1.Axes.Right.Labels.Font.Brush.Color  = Color.FromRgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
            this.tChart1.Axes.Right.Labels.Font.Size         = 9;
            this.tChart1.Axes.Top.Labels.Font.Brush.Color    = Color.FromRgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
            this.tChart1.Axes.Top.Labels.Font.Size           = 9;
            this.tChart1.Header.Font.Brush.Color             = Color.Gray;
            this.tChart1.Header.Font.Size                    = 12;
            this.tChart1.Header.Lines                 = new string[] { tChart1.Zoom.Active.ToString() };//{"Sales Figures"};
            this.tChart1.Legend.Alignment             = Steema.TeeChart.LegendAlignments.Bottom;
            this.tChart1.Legend.Font.Brush.Color      = Color.FromRgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
            this.tChart1.Legend.Font.Size             = 9;
            this.tChart1.Legend.Pen.Visible           = false;
            this.tChart1.Legend.Shadow.Visible        = false;
            this.tChart1.Legend.Transparent           = true;
            this.tChart1.Panel.Brush.Color            = Color.FromRgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
            this.tChart1.Panel.Brush.Gradient.Visible = false;
            this.tChart1.Series.Add(this.bar1);
            this.tChart1.Series.Add(this.bar2);
            this.tChart1.Tools.Add(this.seriesAnimation1);
            this.tChart1.Walls.Back.Brush.Visible = false;
            this.tChart1.Walls.Back.Transparent   = true;
            this.tChart1.Walls.Back.Visible       = false;
            //
            // bar1
            //
            this.bar1.BarRound                = Steema.TeeChart.Styles.BarRounding.AtValue;
            this.bar1.BarStyle                = Steema.TeeChart.Styles.BarStyles.RoundRectangle;
            this.bar1.RoundSize               = 5;
            this.bar1.BarWidthPercent         = 80;
            this.bar1.Brush.Color             = Color.FromRgb(((int)(((byte)(220)))), ((int)(((byte)(92)))), ((int)(((byte)(5)))));
            this.bar1.Color                   = Color.FromRgb(((int)(((byte)(220)))), ((int)(((byte)(92)))), ((int)(((byte)(5)))));
            this.bar1.ColorEach               = false;
            this.bar1.Marks.Arrow.Visible     = false;
            this.bar1.Marks.ArrowLength       = 8;
            this.bar1.Marks.Brush.Color       = Color.FromRgb(((int)(((byte)(220)))), ((int)(((byte)(92)))), ((int)(((byte)(5)))));
            this.bar1.Marks.FollowSeriesColor = true;
            this.bar1.Marks.Font.Brush.Color  = Color.White;
            this.bar1.Marks.Font.Name         = "Segoe UI";
            this.bar1.Marks.Pen.Color         = Color.FromRgb(((int)(((byte)(220)))), ((int)(((byte)(92)))), ((int)(((byte)(5)))));
            this.bar1.Marks.Pen.Visible       = false;
            this.bar1.Marks.Shadow.Visible    = false;
            this.bar1.Marks.Style             = Steema.TeeChart.Styles.MarksStyles.LabelValue;
            this.bar1.OffsetPercent           = -10;
            this.bar1.Pen.Color               = Color.FromRgb(((int)(((byte)(132)))), ((int)(((byte)(55)))), ((int)(((byte)(3)))));
            this.bar1.Pen.Visible             = false;
            this.bar1.Title                   = "Series0";
            this.bar1.XValues.Order           = Steema.TeeChart.Styles.ValueListOrder.Ascending;
            this.bar1.YValues.DataMember      = "Bar";
            //
            // bar2
            //
            this.bar2.BarRound                    = Steema.TeeChart.Styles.BarRounding.AtValue;
            this.bar2.BarStyle                    = Steema.TeeChart.Styles.BarStyles.RoundRectangle;
            this.bar2.RoundSize                   = 5;
            this.bar2.BarWidthPercent             = 80;
            this.bar2.Brush.Color                 = Color.FromRgb(((int)(((byte)(255)))), ((int)(((byte)(172)))), ((int)(((byte)(0)))));
            this.bar2.Color                       = Color.FromRgb(((int)(((byte)(255)))), ((int)(((byte)(172)))), ((int)(((byte)(0)))));
            this.bar2.ColorEach                   = false;
            this.bar2.Marks.Arrow.Visible         = false;
            this.bar2.Marks.ArrowLength           = 8;
            this.bar2.Marks.Brush.Color           = Color.FromRgb(((int)(((byte)(255)))), ((int)(((byte)(172)))), ((int)(((byte)(0)))));
            this.bar2.Marks.FollowSeriesColor     = true;
            this.bar2.Marks.Font.Brush.Color      = Color.White;
            this.bar2.Marks.Font.Name             = "Segoe UI";
            this.bar2.Marks.Pen.Color             = Color.FromRgb(((int)(((byte)(255)))), ((int)(((byte)(172)))), ((int)(((byte)(0)))));
            this.bar2.Marks.Pen.Visible           = false;
            this.bar2.Marks.Shadow.Visible        = false;
            this.bar2.Marks.Style                 = Steema.TeeChart.Styles.MarksStyles.LabelValue;
            this.bar2.Marks.Symbol.Shadow.Visible = false;
            this.bar2.OffsetPercent               = 10;
            this.bar2.Pen.Color                   = Color.FromRgb(((int)(((byte)(153)))), ((int)(((byte)(103)))), ((int)(((byte)(0)))));
            this.bar2.Pen.Visible                 = false;
            this.bar2.Title                       = "Series1";
            this.bar2.XValues.Order               = Steema.TeeChart.Styles.ValueListOrder.Ascending;
            this.bar2.YValues.DataMember          = "Bar";
            //
            // seriesAnimation1
            //
            this.seriesAnimation1.StartValue = 0D;
            //
            // chartPartAnimation1
            //
            this.chartPartAnimation1.Axis           = null;
            quadraticEase1.EasingMode               = Steema.TeeChart.Animations.EasingFunctions.EasingMode.EaseIn;
            this.chartPartAnimation1.EasingFunction = quadraticEase1;
            this.chartPartAnimation1.EasingMode     = Steema.TeeChart.Animations.EasingFunctions.EasingMode.EaseOut;
            this.chartPartAnimation1.Fade           = Steema.TeeChart.Animations.TransformFade.In;
            this.chartPartAnimation1.RotateMax      = 0F;
            this.chartPartAnimation1.RotateMin      = 0F;
            this.chartPartAnimation1.Series         = this.bar1;
            this.chartPartAnimation1.Speed          = 10000;
            this.chartPartAnimation1.Target         = Steema.TeeChart.ChartClickedPartStyle.Series;
            this.chartPartAnimation1.TranslateStyle = Steema.TeeChart.Animations.TransformTranslate.None;
            this.chartPartAnimation1.ZoomStyle      = Steema.TeeChart.Animations.TransformZoom.None;

            tChart1.Panel.Gradient.Visible = false;

            //add series and data
            bar1.Title = "Apples";
            bar1.Clear();
            bar1.Add(5, "jan");
            bar1.Add(2, "feb");
            bar1.Add(1, "mar");
            bar1.Add(4, "apr");
            bar1.Add(10, "may");
            bar1.Add(11, "jun");
            bar1.Add(15, "jul");

            bar2.Title = "Pears";
            bar2.Clear();
            bar2.Add(7);
            bar2.Add(5);
            bar2.Add(1);
            bar2.Add(6);
            bar2.Add(2);
            bar2.Add(11);
            bar2.Add(5);

            tChart1.Axes.Bottom.Labels.Style = Steema.TeeChart.AxisLabelStyle.Text;
            tChart1.Axes.Left.Increment      = 3;

            tChart1.Axes.Left.SetMinMax(0, 15);

            chartPartAnimation1.Play();


            chartView = new ChartView
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                WidthRequest      = 50,
                HeightRequest     = 50
            };
            chartView.Model = tChart1;

            Content = new StackLayout
            {
                Children =
                {
                    chartView
                }
            };
        }
コード例 #13
0
ファイル: Glyphs.cs プロジェクト: cwellsx/wpf-guitartabs
 protected override void setBar(Bar bar, double time)
 {
     bar.Add(this);
 }
コード例 #14
0
        public SubtStdFunctionsChart(ChartView BaseChart)
        {
            subtFunction = new Steema.TeeChart.Functions.Subtract();
            bar1         = new Bar();
            bar2         = new Bar();
            theSubtLine  = new Line();
            var          = new Variables.Variables();

            for (int i = 0; i < var.GetValorStdSubs1.Length; i++)
            {
                bar1.Add(i, var.GetValorStdSubs1[i]);
            }
            for (int i = 0; i < var.GetValorStdSubs2.Length; i++)
            {
                bar2.Add(i, var.GetValorStdSubs2[i]);
            }

            BaseChart.Chart.Series.Add(bar1);
            BaseChart.Chart.Series.Add(bar2);
            BaseChart.Chart.Series.Add(theSubtLine);

            theSubtLine.Function   = subtFunction;
            theSubtLine.DataSource = new object[] { bar1, bar2 };

            bar1.Title         = "Data 1";
            bar1.MarksOnBar    = true;
            bar1.MarksLocation = MarksLocation.Start;
            bar1.SeriesColor   = var.GetPaletteBasic[0];

            bar2.Title         = "Data 2";
            bar2.MarksOnBar    = true;
            bar2.MarksLocation = MarksLocation.Start;
            bar2.SeriesColor   = var.GetPaletteBasic[1];

            theSubtLine.Title                  = "Subtract";
            theSubtLine.LinePen.Width          = 6;
            theSubtLine.Pointer.Style          = PointerStyles.Sphere;
            theSubtLine.Pointer.InflateMargins = true;
            theSubtLine.Pointer.HorizSize      = 5;
            theSubtLine.Pointer.VertSize       = 5;
            theSubtLine.TreatNulls             = TreatNullsStyle.DoNotPaint;
            theSubtLine.Pointer.Visible        = true;
            theSubtLine.Marks.Visible          = true;
            theSubtLine.SeriesColor            = var.GetPaletteBasic[2];

            BaseChart.Chart.Axes.Left.SetMinMax(BaseChart.Chart.Axes.Left.MinYValue + 0.3, BaseChart.Chart.Axes.Left.MaxYValue + 3);
            BaseChart.Chart.Axes.Bottom.SetMinMax(BaseChart.Chart.Axes.Bottom.MinXValue, BaseChart.Chart.Axes.Bottom.MaxXValue);
            BaseChart.Chart.Axes.Left.Increment        = 10;
            BaseChart.Chart.Axes.Bottom.Labels.Visible = false;
            BaseChart.Chart.Axes.Left.Grid.Visible     = false;
            BaseChart.Chart.Axes.Left.AxisPen.Visible  = true;
            BaseChart.Chart.Header.Visible             = false;

            Themes.AplicarMarksTheme1(BaseChart);

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

            bar1.Marks.Pen.Visible = false;
            bar2.Marks.Pen.Visible = false;

            bar1.Marks.TailStyle = MarksTail.None;
            bar2.Marks.TailStyle = MarksTail.None;

            BaseChart.Chart.Series[0].Marks.TextAlign = TextAlignment.Center;
            BaseChart.Chart.Series[0].Marks.AutoSize  = true;
            BaseChart.Chart.Series[0].Marks.Color     = Xamarin.Forms.Color.Transparent;
            BaseChart.Chart.Series[1].Marks.TextAlign = TextAlignment.Center;
            BaseChart.Chart.Series[1].Marks.AutoSize  = true;
            BaseChart.Chart.Series[1].Marks.Color     = Xamarin.Forms.Color.Transparent;
            BaseChart.Chart.Series[2].Marks.TailStyle = MarksTail.None;
            BaseChart.Chart.Panel.MarginLeft          = 5;
        }
        public DivStdFunctionsChart(ChartView BaseChart)
        {
            divFunction = new Steema.TeeChart.Functions.Divide();
            bar1        = new Bar();
            bar2        = new Bar();
            theDivLine  = new Line();
            var         = new Variables.Variables();

            for (int i = 0; i < var.GetValorStdDiv1.Length; i++)
            {
                bar1.Add(i, var.GetValorStdDiv1[i]);
            }
            for (int i = 0; i < var.GetValorStdDiv2.Length; i++)
            {
                bar2.Add(i, var.GetValorStdDiv2[i]);
            }

            BaseChart.Chart.Series.Add(bar1);
            BaseChart.Chart.Series.Add(bar2);
            BaseChart.Chart.Series.Add(theDivLine);

            theDivLine.Function   = divFunction;
            theDivLine.DataSource = new object[] { bar1, bar2 };

            bar1.SeriesColor       = var.GetPaletteBasic[0];
            bar2.SeriesColor       = var.GetPaletteBasic[1];
            theDivLine.SeriesColor = var.GetPaletteBasic[2];

            bar1.Title         = "Data 1";
            bar1.MarksOnBar    = true;
            bar1.MarksLocation = MarksLocation.Start;

            bar2.Title         = "Data 2";
            bar2.MarksOnBar    = true;
            bar2.MarksLocation = MarksLocation.Start;

            theDivLine.Title                  = "Divide";
            theDivLine.LinePen.Width          = 6;
            theDivLine.Pointer.Style          = PointerStyles.Sphere;
            theDivLine.Pointer.InflateMargins = true;
            theDivLine.Pointer.HorizSize      = 5;
            theDivLine.Pointer.VertSize       = 5;
            theDivLine.Pointer.Visible        = true;
            theDivLine.Marks.Visible          = true;

            BaseChart.Chart.Axes.Left.SetMinMax(BaseChart.Chart.Axes.Left.MinYValue + 0.1, BaseChart.Chart.Axes.Left.MaxYValue + 2);
            BaseChart.Chart.Axes.Bottom.SetMinMax(BaseChart.Chart.Axes.Bottom.MinXValue, BaseChart.Chart.Axes.Bottom.MaxXValue);
            BaseChart.Chart.Axes.Left.Increment        = 3;
            BaseChart.Chart.Axes.Bottom.Labels.Visible = false;
            BaseChart.Chart.Axes.Left.Grid.Visible     = false;
            BaseChart.Chart.Axes.Left.AxisPen.Visible  = true;
            BaseChart.Chart.Header.Visible             = false;

            bar1.Marks.Font.Size   = 14;
            bar1.Marks.Pen.Visible = false;
            bar1.Marks.TailStyle   = MarksTail.None;
            bar1.Marks.Height     += 4;
            bar1.Marks.TextAlign   = TextAlignment.Center;
            bar1.Marks.BackColor   = Xamarin.Forms.Color.Transparent;
            bar1.Marks.Font.Color  = Color.White;

            bar2.Marks.Font.Size   = 14;
            bar2.Marks.TailStyle   = MarksTail.None;
            bar2.Marks.TextAlign   = TextAlignment.Center;
            bar2.Marks.BackColor   = Xamarin.Forms.Color.Transparent;
            bar2.Marks.Height     += 4;
            bar2.Marks.Pen.Visible = false;
            bar2.Marks.Font.Color  = Color.White;

            theDivLine.Marks.Font.Size         = 15;
            theDivLine.Marks.FollowSeriesColor = true;
            theDivLine.Marks.TailStyle         = MarksTail.None;
            theDivLine.Marks.Pen.Width         = 1;
            theDivLine.Marks.Pen.Color         = theDivLine.Color.AddLuminosity(-0.3);

            BaseChart.Chart.Panel.MarginLeft = 5;

            ImplementiOSMarks(BaseChart.Chart);
        }
コード例 #16
0
        public BarStylesChartFeatures(ChartView BaseChart)
        {
            bar1           = new Bar();
            var            = new Variables.Variables();
            this.BaseChart = BaseChart;

            BaseChart.Chart.Legend.Visible = true;
            BaseChart.Chart.Header.Text    = "Product sale";
            BaseChart.Chart.Series.Add(bar1);

            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            = "ConeBar1";
            bar1.DefaultNullValue = 0;
            for (int i = 0; i < var.GetValorConeBar1.Length; i++)
            {
                bar1.Add(var.GetValorConeBar1[i], var.GetValorConeBarX[i]);
            }
            bar1.MarksOnBar      = false;
            bar1.Marks.Style     = MarksStyles.Value;
            bar1.BarWidthPercent = 90;
            bar1.BarStyle        = BarStyles.Arrow;
            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.Ticks.Visible        = false;
            BaseChart.Chart.Axes.Left.Title                = null;
            BaseChart.Chart.Axes.Bottom.Title              = null;
            BaseChart.Chart.Axes.Left.Ticks.Visible        = false;
            BaseChart.Chart.Axes.Bottom.Labels.ValueFormat = "0";
            BaseChart.Chart.Axes.Left.Labels.ValueFormat   = "0";
            BaseChart.Chart.Axes.Bottom.Grid.Visible       = false;
            BaseChart.Chart.Axes.Left.Grid.Visible         = false;
            BaseChart.Chart.Axes.Left.Increment            = 2;
            BaseChart.Chart.Legend.Visible              = false;
            BaseChart.Chart.Legend.LegendStyle          = LegendStyles.Series;
            BaseChart.Chart.ClickSeries                += Chart_ClickSeries;
            BaseChart.Chart.Axes.Left.Labels.CustomSize = 0;
            BaseChart.Chart.Axes.Bottom.LabelsOnAxis    = true;
            BaseChart.Chart.Footer.Visible              = true;
            BaseChart.Chart.Footer.Font.Size            = 18;
            BaseChart.Chart.Footer.Font.Color           = Color.FromArgb(110, 110, 110);
            BaseChart.Chart.Footer.Height               = 110;

            // Themes Marks
            Themes.AplicarMarksTheme1(BaseChart);

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

            bar1.Marks.Pen.Visible = false;

            BaseChart.Chart.Series[0].Marks.TextAlign = Xamarin.Forms.TextAlignment.Center;
            BaseChart.Chart.Series[0].Marks.AutoSize  = true;
            BaseChart.Chart.Series[0].Marks.Color     = Color.Transparent;
            BaseChart.Chart.Panel.MarginLeft          = 5;

            BaseChart.Chart.Axes.Left.Visible = false;
        }
コード例 #17
0
        // Pending Animations for Xamarin.Forms
        //private Steema.TeeChart.Tools.SeriesAnimation seriesAnimation1;

        public StackedBars()
        {
            this.Title = "Stacked Bars";

            tChart1 = new ChartView();
            tChart1.WidthRequest  = 400;
            tChart1.HeightRequest = 300;

            tChart1.Chart.Aspect.View3D = false;

            this.bar1 = new Steema.TeeChart.Styles.Bar();
            this.bar2 = new Steema.TeeChart.Styles.Bar();
            this.bar3 = new Steema.TeeChart.Styles.Bar();
            // Pending Animations for Xamarin.Forms
            //this.seriesAnimation1 = new Steema.TeeChart.Tools.SeriesAnimation();
            // tChart1
            this.tChart1.Chart.Aspect.ColorPaletteIndex            = 20;
            this.tChart1.Chart.Aspect.View3D                       = false;
            this.tChart1.Chart.Axes.Bottom.Grid.DrawEvery          = 2;
            this.tChart1.Chart.Axes.Bottom.Grid.Visible            = false;
            this.tChart1.Chart.Axes.Bottom.Labels.Font.Brush.Color = Color.FromRgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
            this.tChart1.Chart.Axes.Bottom.Labels.Font.Size        = 9;
            this.tChart1.Chart.Axes.Bottom.Title.Font.Brush.Color  = Color.FromRgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
            this.tChart1.Chart.Axes.Bottom.Title.Font.Size         = 11;
            this.tChart1.Chart.Axes.Left.AxisPen.Visible           = false;
            this.tChart1.Chart.Axes.Left.Grid.DrawEvery            = 2;
            this.tChart1.Chart.Axes.Left.Grid.Style                = Steema.TeeChart.Drawing.DashStyle.Solid;
            this.tChart1.Chart.Axes.Left.Labels.Font.Brush.Color   = Color.Gray;
            this.tChart1.Chart.Axes.Left.Labels.Font.Size          = 9;
            this.tChart1.Chart.Axes.Left.MinorTicks.Visible        = false;
            this.tChart1.Chart.Axes.Left.Ticks.Visible             = false;
            this.tChart1.Chart.Axes.Left.Title.Caption             = "$ 000s";
            this.tChart1.Chart.Axes.Left.Title.Font.Brush.Color    = Color.FromRgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
            this.tChart1.Chart.Axes.Left.Title.Font.Size           = 11;
            this.tChart1.Chart.Axes.Left.Title.Lines               = new string[] { "$ 000s" };
            this.tChart1.Chart.Axes.Right.AxisPen.Visible          = false;
            this.tChart1.Chart.Axes.Right.Increment                = 5D;
            this.tChart1.Chart.Axes.Right.Labels.Font.Brush.Color  = Color.FromRgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
            this.tChart1.Chart.Axes.Right.Labels.Font.Size         = 9;
            this.tChart1.Chart.Axes.Right.Title.Caption            = "Billions";
            this.tChart1.Chart.Axes.Right.Title.Lines              = new string[] { "Billions" };
            this.tChart1.Chart.Axes.Top.Labels.Font.Brush.Color    = Color.FromRgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
            this.tChart1.Chart.Axes.Top.Labels.Font.Size           = 9;
            this.tChart1.Chart.Footer.Alignment                    = TextAlignment.Start;
            this.tChart1.Chart.Footer.Font.Brush.Color             = Color.Black;
            this.tChart1.Chart.Footer.Font.Italic                  = true;
            this.tChart1.Chart.Footer.Font.Name                    = "Verdana";
            this.tChart1.Chart.Footer.Lines                 = new string[] { "Source : BI Intelligence estimates, Interactive Advertising Bureau" };
            this.tChart1.Chart.Footer.Visible               = true;
            this.tChart1.Chart.Header.Font.Brush.Color      = Color.Gray;
            this.tChart1.Chart.Header.Font.Size             = 12;
            this.tChart1.Chart.Header.Lines                 = new string[] { "Native Advertising Revenue" };
            this.tChart1.Chart.Legend.Alignment             = Steema.TeeChart.LegendAlignments.Top;
            this.tChart1.Chart.Legend.Font.Brush.Color      = Color.FromRgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
            this.tChart1.Chart.Legend.Pen.Visible           = false;
            this.tChart1.Chart.Legend.Shadow.Visible        = false;
            this.tChart1.Chart.Legend.Transparent           = true;
            this.tChart1.Chart.Panel.Bevel.Outer            = Steema.TeeChart.Drawing.BevelStyles.None;
            this.tChart1.Chart.Panel.Bevel.Width            = 2;
            this.tChart1.Chart.Panel.BevelWidth             = 2;
            this.tChart1.Chart.Panel.Brush.Color            = Color.FromRgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
            this.tChart1.Chart.Panel.Brush.Gradient.Visible = false;
            this.tChart1.Chart.Series.Add(this.bar1);
            this.tChart1.Chart.Series.Add(this.bar2);
            this.tChart1.Chart.Series.Add(this.bar3);
            this.tChart1.Chart.SubHeader.Font.Brush.Color = Color.FromRgb(((int)(((byte)(157)))), ((int)(((byte)(157)))), ((int)(((byte)(157)))));
            this.tChart1.Chart.SubHeader.Lines            = new string[] { "Desktop and Mobile" };
            this.tChart1.Chart.SubHeader.Visible          = true;
            // Pending Animations for Xamarin.Forms
            //this.tChart1.Tools.Add(this.seriesAnimation1);
            this.tChart1.Chart.Walls.Back.Brush.Visible = false;
            this.tChart1.Chart.Walls.Back.Transparent   = true;
            this.tChart1.Chart.Walls.Back.Visible       = false;
            this.tChart1.Chart.GetAxisLabel            += new Steema.TeeChart.GetAxisLabelEventHandler(this.tChart1_GetAxisLabel);
            // bar1
            this.bar1.BarRound                = Steema.TeeChart.Styles.BarRounding.AtValue;
            this.bar1.Brush.Color             = Color.FromRgb(((int)(((byte)(68)))), ((int)(((byte)(102)))), ((int)(((byte)(163)))));
            this.bar1.Color                   = Color.FromRgb(((int)(((byte)(68)))), ((int)(((byte)(102)))), ((int)(((byte)(163)))));
            this.bar1.ColorEach               = false;
            this.bar1.Marks.Arrow.Visible     = false;
            this.bar1.Marks.ArrowLength       = 8;
            this.bar1.Marks.Brush.Color       = Color.FromRgb(((int)(((byte)(68)))), ((int)(((byte)(102)))), ((int)(((byte)(163)))));
            this.bar1.Marks.FollowSeriesColor = true;
            this.bar1.Marks.Font.Brush.Color  = Color.White;
            this.bar1.Marks.Pen.Color         = Color.FromRgb(((int)(((byte)(68)))), ((int)(((byte)(102)))), ((int)(((byte)(163)))));
            this.bar1.Marks.Shadow.Visible    = false;
            this.bar1.MultiBar                = Steema.TeeChart.Styles.MultiBars.Stacked;
            this.bar1.Pen.Color               = Color.FromRgb(((int)(((byte)(41)))), ((int)(((byte)(61)))), ((int)(((byte)(98)))));
            this.bar1.Title                   = "Native-Style Display";
            this.bar1.VertAxis                = Steema.TeeChart.Styles.VerticalAxis.Right;
            this.bar1.XValues.Order           = Steema.TeeChart.Styles.ValueListOrder.Ascending;
            this.bar1.GetSeriesMark          += new Steema.TeeChart.Styles.Series.GetSeriesMarkEventHandler(this.bar1_GetSeriesMark);
            // bar2
            this.bar2.BarRound                = Steema.TeeChart.Styles.BarRounding.AtValue;
            this.bar2.Brush.Color             = Color.FromRgb(((int)(((byte)(243)))), ((int)(((byte)(156)))), ((int)(((byte)(53)))));
            this.bar2.Color                   = Color.FromRgb(((int)(((byte)(243)))), ((int)(((byte)(156)))), ((int)(((byte)(53)))));
            this.bar2.ColorEach               = false;
            this.bar2.Marks.Arrow.Visible     = false;
            this.bar2.Marks.ArrowLength       = 8;
            this.bar2.Marks.Brush.Color       = Color.FromRgb(((int)(((byte)(243)))), ((int)(((byte)(156)))), ((int)(((byte)(53)))));
            this.bar2.Marks.FollowSeriesColor = true;
            this.bar2.Marks.Font.Brush.Color  = Color.White;
            this.bar2.Marks.Pen.Color         = Color.FromRgb(((int)(((byte)(243)))), ((int)(((byte)(156)))), ((int)(((byte)(53)))));
            this.bar2.Marks.Shadow.Visible    = false;
            this.bar2.MultiBar                = Steema.TeeChart.Styles.MultiBars.Stacked;
            this.bar2.Pen.Color               = Color.FromRgb(((int)(((byte)(146)))), ((int)(((byte)(94)))), ((int)(((byte)(32)))));
            this.bar2.Title                   = "Sponsorship";
            this.bar2.VertAxis                = Steema.TeeChart.Styles.VerticalAxis.Right;
            this.bar2.XValues.Order           = Steema.TeeChart.Styles.ValueListOrder.Ascending;
            // bar3
            this.bar3.BarRound                = Steema.TeeChart.Styles.BarRounding.AtValue;
            this.bar3.Brush.Color             = Color.FromRgb(((int)(((byte)(241)))), ((int)(((byte)(76)))), ((int)(((byte)(20)))));
            this.bar3.Color                   = Color.FromRgb(((int)(((byte)(241)))), ((int)(((byte)(76)))), ((int)(((byte)(20)))));
            this.bar3.ColorEach               = false;
            this.bar3.Marks.Arrow.Visible     = false;
            this.bar3.Marks.ArrowLength       = 8;
            this.bar3.Marks.Brush.Color       = Color.FromRgb(((int)(((byte)(241)))), ((int)(((byte)(76)))), ((int)(((byte)(20)))));
            this.bar3.Marks.FollowSeriesColor = true;
            this.bar3.Marks.Font.Brush.Color  = Color.White;
            this.bar3.Marks.Pen.Color         = Color.FromRgb(((int)(((byte)(241)))), ((int)(((byte)(76)))), ((int)(((byte)(20)))));
            this.bar3.Marks.Shadow.Visible    = false;
            this.bar3.MultiBar                = Steema.TeeChart.Styles.MultiBars.Stacked;
            this.bar3.Pen.Color               = Color.FromRgb(((int)(((byte)(145)))), ((int)(((byte)(46)))), ((int)(((byte)(12)))));
            this.bar3.Title                   = "Social";
            this.bar3.VertAxis                = Steema.TeeChart.Styles.VerticalAxis.Right;
            this.bar3.XValues.Order           = Steema.TeeChart.Styles.ValueListOrder.Ascending;
            // seriesAnimation1
            // Pending Animations for Xamarin.Forms
            //this.seriesAnimation1.StartValue = 0;
            //this.seriesAnimation1.Series = bar3;
            //this.seriesAnimation1.Execute();
            // StackedBars

            tChart1.Chart.Panel.Gradient.Visible = false;

            bar1.Add(1);
            bar1.Add(1.3);
            bar1.Add(1.9);
            bar1.Add(2.7);
            bar1.Add(3.9);
            bar1.Add(5.7);

            bar2.Add(0.8);
            bar2.Add(1);
            bar2.Add(1.3);
            bar2.Add(2);
            bar2.Add(2.7);
            bar2.Add(3.4);

            bar3.Add(2.9);
            bar3.Add(5.6);
            bar3.Add(7.5);
            bar3.Add(9.2);
            bar3.Add(10.7);
            bar3.Add(11.9);

            bar3.BarStyle    = BarStyles.RoundRectangle;
            bar3.Pen.Visible = false;
            bar2.Pen.Visible = false;
            bar1.Pen.Visible = false;

            this.tChart1.Chart.Aspect.ZoomText = true;

            Content = new StackLayout
            {
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Children          =
                {
                    tChart1
                }
            };
        }
        public GradientBarChartFeatures(ChartView BaseChart)
        {
            bar1           = new Bar();
            bar2           = new Bar();
            var            = new Variables.Variables();
            this.BaseChart = BaseChart;

            BaseChart.Chart.Legend.Visible = true;
            BaseChart.Chart.Header.Text    = "Time spent on certain activities";
            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            = "Man 1";
            bar1.DefaultNullValue = 0;
            for (int i = 0; i < var.GetValorColumn1.Length; i++)
            {
                bar1.Add(var.GetValorGradientBar1[i], var.GetValorGradientBarX[i]);
            }
            bar1.MarksOnBar           = true;
            bar1.MarksLocation        = MarksLocation.Start;
            bar1.Marks.Style          = MarksStyles.Value;
            bar1.BarWidthPercent      = 80;
            bar1.Gradient.Visible     = true;
            bar1.Gradient.Direction   = GradientDirection.TopBottom;
            bar1.Gradient.StartColor  = var.GetPaletteBasic[0].AddLuminosity(-0.25);
            bar1.Gradient.MiddleColor = var.GetPaletteBasic[0];
            bar1.Gradient.EndColor    = var.GetPaletteBasic[0].AddLuminosity(0.25);
            bar1.VertAxis             = VerticalAxis.Both;
            bar1.HorizAxis            = HorizontalAxis.Both;

            bar2.Colors = new ColorList {
                var.GetPaletteBasic[1]
            };
            bar2.SeriesColor         = var.GetPaletteBasic[1];
            bar2.Chart.Zoom.Allow    = false;
            bar2.Chart.Panning.Allow = ScrollModes.None;
            bar2.RecalcOptions       = RecalcOptions.OnModify;
            bar2.Title            = "Man 2";
            bar2.DefaultNullValue = 0;
            for (int i = 0; i < var.GetValorColumn2.Length; i++)
            {
                bar2.Add(var.GetValorGradientBar2[i], var.GetValorGradientBarX[i]);
            }
            bar2.ZOrder               = 0;
            bar2.MarksOnBar           = true;
            bar2.Marks.Style          = MarksStyles.Value;
            bar2.MarksLocation        = MarksLocation.Start;
            bar2.BarWidthPercent      = 80;
            bar2.Gradient.Visible     = true;
            bar2.Gradient.Direction   = GradientDirection.TopBottom;
            bar2.Gradient.StartColor  = var.GetPaletteBasic[1].AddLuminosity(-0.25);
            bar2.Gradient.MiddleColor = var.GetPaletteBasic[1];
            bar2.Gradient.EndColor    = var.GetPaletteBasic[1].AddLuminosity(0.25);
            bar2.VertAxis             = VerticalAxis.Both;
            bar2.HorizAxis            = HorizontalAxis.Both;

            BaseChart.Chart.Axes.Left.SetMinMax(BaseChart.Chart.Axes.Left.MinYValue, BaseChart.Chart.Axes.Left.MaxYValue + 10);
            BaseChart.Chart.Axes.Bottom.SetMinMax(BaseChart.Chart.Axes.Bottom.MinXValue, BaseChart.Chart.Axes.Bottom.MaxXValue);
            BaseChart.Chart.Axes.Left.Title   = null;
            BaseChart.Chart.Axes.Bottom.Title = null;
            BaseChart.Chart.Axes.Left.Visible = false;
            BaseChart.Chart.Axes.Bottom.Labels.ValueFormat = "0";
            BaseChart.Chart.Axes.Left.Labels.ValueFormat   = "0";
            BaseChart.Chart.Axes.Bottom.Grid.Visible       = false;
            BaseChart.Chart.Axes.Left.Increment            = 2;
            BaseChart.Chart.Legend.LegendStyle             = LegendStyles.Series;
            //BaseChart.Chart.ClickSeries += Chart_ClickSeries;
            BaseChart.Chart.Axes.Left.Labels.CustomSize = 0;

            // Themes Marks
            Themes.AplicarMarksTheme1(BaseChart);

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

            bar1.Marks.Pen.Visible = false;
            bar2.Marks.Pen.Visible = false;

            BaseChart.Chart.Series[0].Marks.TextAlign = Xamarin.Forms.TextAlignment.Center;
            BaseChart.Chart.Series[0].Marks.AutoSize  = true;
            BaseChart.Chart.Series[0].Marks.Color     = Color.Transparent;
            BaseChart.Chart.Series[1].Marks.TextAlign = Xamarin.Forms.TextAlignment.Center;
            BaseChart.Chart.Series[1].Marks.AutoSize  = true;
            BaseChart.Chart.Series[1].Marks.Color     = Color.Transparent;
            BaseChart.Chart.Panel.MarginLeft          = 5;
        }
コード例 #19
0
        /// <summary>
        /// 根据DataGridView中选中列数据绘制柱状图
        /// </summary>
        /// <param name="tChart1"></param>
        /// <param name="tmp_bar"></param>
        /// <param name="dgv"></param>
        private void AddBar(TChart tChart1, Bar tmp_bar, DataGridView dgv, int Xindex)
        {
            int j = 0;

            flagtime        = false;
            dgv.MultiSelect = false;
            double   tmp_value = 0;
            DateTime tmp_times;

            j = dgv.CurrentCell.ColumnIndex;
            int count = dgv.Rows.Count;

            double[]   tmp_Yvalue = new double[count - 1];
            DateTime[] tmp_time   = new DateTime[count - 1];
            string[]   XValue     = new string[count - 1];
            for (int i = 0; i < dgv.Rows.Count - 1; i++)//y轴数据列
            {
                if (j != 0)
                {
                    if (double.TryParse(dgv.Rows[i].Cells[j].Value.ToString(), out tmp_value))
                    {
                        if (dgv.Rows[i].Cells[j].Value.ToString() != "" && dgv.Rows[i].Cells[j].Value != null)
                        {
                            tmp_Yvalue[i] = Convert.ToDouble(dgv.Rows[i].Cells[j].Value.ToString());
                        }
                    }
                    else
                    {
                        MessageBox.Show("请选择数据列!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        for (int s = 0; s < dgv.Rows.Count - 1; s++)
                        {
                            tmp_Yvalue[s] = 0;
                        }
                        break;
                    }
                }
            }
            for (int i = 0; i < dgv.Rows.Count - 1; i++)//x轴是否为时间列
            {
                if (j != 0)
                {
                    if (DateTime.TryParse(dgv.Rows[i].Cells[Xindex].Value.ToString(), out tmp_times))
                    {
                        if (dgv.Rows[i].Cells[Xindex].Value.ToString() != "" && dgv.Rows[i].Cells[Xindex].Value != null)
                        {
                            tmp_time[i] = Convert.ToDateTime(dgv.Rows[i].Cells[Xindex].Value.ToString());
                        }
                        flagtime = true;
                    }
                    else
                    {
                        flagtime = false;
                        break;
                    }
                }
            }
            for (int i = 0; i < dgv.Rows.Count - 1; i++)//x轴不为时间列
            {
                if (j != 0)
                {
                    if (!flagtime)
                    {
                        if (dgv.Rows[i].Cells[Xindex].Value.ToString() != "" && dgv.Rows[i].Cells[Xindex].Value != null)
                        {
                            XValue[i] = dgv.Rows[i].Cells[Xindex].Value.ToString();
                        }
                    }
                    else
                    {
                        break;
                    }
                }
            }

            tChart1.Aspect.View3D          = false; //是否3D显示
            tmp_bar.Marks.Gradient.Visible = true;  //显示网格
            tmp_bar.Marks.Visible          = false;

            tmp_bar.Marks.Gradient.StartColor = Color.FromArgb(255, 215, 0);//网格颜色设置
            tmp_bar.Marks.Gradient.EndColor   = Color.White;
            tmp_bar.Marks.Symbol.Visible      = true;
            if (flagtime)
            {
                tmp_bar.Add(tmp_time, tmp_Yvalue);
                DateTime mindt = getMin(tmp_time);
                DateTime maxdt = getMax(tmp_time);
                tChart1.Axes.Bottom.SetMinMax(mindt, maxdt);
            }
            else
            {
                for (int m = 0; m < tmp_Yvalue.Length; m++)
                {
                    tmp_bar.Add(tmp_Yvalue[m], XValue[m]);
                }
                int len = XValue.Length;
                tChart1.Axes.Bottom.SetMinMax(0, len);
            }
            tChart1.Axes.Bottom.MaximumOffset = 0;
            tChart1.Axes.Bottom.MinimumOffset = 0;
            tChart1.Axes.Left.Automatic       = false;
            tChart1.Axes.Left.Minimum         = getMin(tmp_Yvalue) - 1;
            tChart1.Axes.Left.Maximum         = getMax(tmp_Yvalue) + 1;
            tChart1.Axes.Bottom.Automatic     = false;
            tChart1.Axes.Left.Increment       = 0; //纵坐标增量
            tChart1.Axes.Bottom.Increment     = 0; //横坐标增量

            tChart1.Refresh();
            tChart1.Axes.Bottom.Labels.MultiLine = false;
        }
        public MultStdFunctionsChart(ChartView BaseChart)
        {
            multFunction = new Steema.TeeChart.Functions.Multiply();
            bar1         = new Bar();
            bar2         = new Bar();
            theMultLine  = new Line();
            var          = new Variables.Variables();

            for (int i = 0; i < var.GetValorStdMult1.Length; i++)
            {
                bar1.Add(i, var.GetValorStdMult1[i]);
            }
            for (int i = 0; i < var.GetValorStdMult2.Length; i++)
            {
                bar2.Add(i, var.GetValorStdMult2[i]);
            }

            BaseChart.Chart.Series.Add(bar1);
            BaseChart.Chart.Series.Add(bar2);
            BaseChart.Chart.Series.Add(theMultLine);

            theMultLine.Function   = multFunction;
            theMultLine.DataSource = new object[] { bar1, bar2 };

            bar1.SeriesColor        = var.GetPaletteBasic[0];
            bar2.SeriesColor        = var.GetPaletteBasic[1];
            theMultLine.SeriesColor = var.GetPaletteBasic[2];

            bar1.Title         = "Data 1";
            bar1.MarksOnBar    = true;
            bar1.MarksLocation = MarksLocation.Start;

            bar2.Title         = "Data 2";
            bar2.MarksOnBar    = true;
            bar2.MarksLocation = MarksLocation.Start;

            theMultLine.Title                  = "Multiply";
            theMultLine.LinePen.Width          = 6;
            theMultLine.Pointer.Style          = PointerStyles.Sphere;
            theMultLine.Pointer.InflateMargins = true;
            theMultLine.Pointer.HorizSize      = 5;
            theMultLine.Pointer.VertSize       = 5;
            theMultLine.Pointer.Visible        = true;
            theMultLine.Marks.Visible          = true;

            BaseChart.Chart.Axes.Left.SetMinMax(BaseChart.Chart.Axes.Left.MinYValue + 0.1, BaseChart.Chart.Axes.Left.MaxYValue + 2);
            BaseChart.Chart.Axes.Bottom.SetMinMax(BaseChart.Chart.Axes.Bottom.MinXValue, BaseChart.Chart.Axes.Bottom.MaxXValue);
            BaseChart.Chart.Axes.Left.Increment        = 3;
            BaseChart.Chart.Axes.Bottom.Labels.Visible = false;
            BaseChart.Chart.Axes.Left.Grid.Visible     = false;
            BaseChart.Chart.Axes.Left.AxisPen.Visible  = true;
            BaseChart.Chart.Header.Visible             = false;

            Themes.AplicarMarksTheme1(BaseChart);
            BaseChart.Chart.Series[0].Marks.Font.Size = 14;
            BaseChart.Chart.Series[1].Marks.Font.Size = 14;

            bar1.Marks.Pen.Visible = false;
            bar2.Marks.Pen.Visible = false;

            bar1.Marks.TailStyle = MarksTail.None;
            bar2.Marks.TailStyle = MarksTail.None;

            BaseChart.Chart.Series[0].Marks.TextAlign = TextAlignment.Center;
            BaseChart.Chart.Series[0].Marks.AutoSize  = true;
            BaseChart.Chart.Series[0].Marks.Color     = Xamarin.Forms.Color.Transparent;
            BaseChart.Chart.Series[1].Marks.TextAlign = TextAlignment.Center;
            BaseChart.Chart.Series[1].Marks.AutoSize  = true;
            BaseChart.Chart.Series[1].Marks.Color     = Xamarin.Forms.Color.Transparent;
            //BaseChart.Chart.Series[2].Marks.ShapeBounds = new Xamarin.Forms.Rectangle { Width = 80, Height = 50 };
            BaseChart.Chart.Series[2].Marks.TailStyle = MarksTail.None;
            BaseChart.Chart.Panel.MarginLeft          = 5;

            ImplementiOSMarks(BaseChart.Chart);
        }
        private void InitializeChart()
        {
            chartPartAnimation1 = new ChartPartAnimation(tChart1.Chart);
            this.tChart1.Animations.Add(this.chartPartAnimation1);
            this.tChart1.Aspect.ColorPaletteIndex            = 20;
            this.tChart1.Aspect.View3D                       = false;
            this.tChart1.Axes.Bottom.Grid.DrawEvery          = 2;
            this.tChart1.Axes.Bottom.Grid.Visible            = false;
            this.tChart1.Axes.Bottom.Labels.Font.Brush.Color = Color.FromArgb(255, ((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
            this.tChart1.Axes.Bottom.Labels.Font.Size        = 9;
            this.tChart1.Axes.Bottom.Title.Font.Brush.Color  = Color.FromArgb(255, ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
            this.tChart1.Axes.Bottom.Title.Font.Size         = 11;
            this.tChart1.Axes.Left.AxisPen.Visible           = false;
            this.tChart1.Axes.Left.Grid.DrawEvery            = 2;
            this.tChart1.Axes.Left.Grid.Style                = DashStyles.Solid;
            this.tChart1.Axes.Left.Labels.Font.Brush.Color   = Colors.Gray;
            this.tChart1.Axes.Left.Labels.Font.Size          = 9;
            this.tChart1.Axes.Left.MinorTicks.Visible        = false;
            this.tChart1.Axes.Left.Ticks.Visible             = false;
            this.tChart1.Axes.Left.Title.Caption             = "$ 000s";
            this.tChart1.Axes.Left.Title.Font.Brush.Color    = Color.FromArgb(255, ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
            this.tChart1.Axes.Left.Title.Font.Size           = 11;
            this.tChart1.Axes.Left.Title.Lines               = new string[] {
                "$ 000s"
            };
            this.tChart1.Axes.Right.AxisPen.Visible         = false;
            this.tChart1.Axes.Right.Labels.Font.Brush.Color = Color.FromArgb(255, ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
            this.tChart1.Axes.Right.Labels.Font.Size        = 9;
            this.tChart1.Axes.Top.Labels.Font.Brush.Color   = Color.FromArgb(255, ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
            this.tChart1.Axes.Top.Labels.Font.Size          = 9;
            this.tChart1.CurrentTheme            = ThemeType.Lookout;
            this.tChart1.Header.Font.Brush.Color = Colors.Gray;
            this.tChart1.Header.Font.Size        = 12;
            this.tChart1.Header.Lines            = new string[] {
                "Sales Figures"
            };
            this.tChart1.Legend.Alignment        = LegendAlignments.Bottom;
            this.tChart1.Legend.Font.Brush.Color = Color.FromArgb(255, ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
            this.tChart1.Legend.Font.Size        = 9;
            this.tChart1.Legend.Pen.Visible      = false;
            this.tChart1.Legend.Shadow.Visible   = false;
            this.tChart1.Legend.Transparent      = true;
            this.tChart1.Name = "tChart1";
            this.tChart1.Panel.Brush.Color            = Color.FromArgb(255, ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
            this.tChart1.Panel.Brush.Gradient.Visible = false;
            this.tChart1.Series.Add(this.bar1);
            this.tChart1.Series.Add(this.bar2);
            this.tChart1.TabIndex = 0;
            //this.tChart1.Tools.Add(this.seriesAnimation1);
            this.tChart1.Walls.Back.Brush.Visible = false;
            this.tChart1.Walls.Back.Transparent   = true;
            this.tChart1.Walls.Back.Visible       = false;
            this.bar1.BarRound                    = BarRounding.AtValue;
            this.bar1.BarStyle                    = BarStyles.RoundRectangle;
            this.bar1.BarWidthPercent             = 80;
            this.bar1.Brush.Color                 = Color.FromArgb(255, ((int)(((byte)(220)))), ((int)(((byte)(92)))), ((int)(((byte)(5)))));
            this.bar1.Color                       = Color.FromArgb(255, ((int)(((byte)(220)))), ((int)(((byte)(92)))), ((int)(((byte)(5)))));
            this.bar1.ColorEach                   = false;
            this.bar1.Marks.Arrow.Visible         = false;
            this.bar1.Marks.ArrowLength           = 8;
            this.bar1.Marks.Brush.Color           = Color.FromArgb(255, ((int)(((byte)(220)))), ((int)(((byte)(92)))), ((int)(((byte)(5)))));
            this.bar1.Marks.FollowSeriesColor     = true;
            this.bar1.Marks.Font.Brush.Color      = Colors.White;
            this.bar1.Marks.Font.Name             = "Segoe UI";
            this.bar1.Marks.Pen.Color             = Color.FromArgb(255, ((int)(((byte)(220)))), ((int)(((byte)(92)))), ((int)(((byte)(5)))));
            this.bar1.Marks.Pen.Visible           = false;
            this.bar1.Marks.Shadow.Visible        = false;
            this.bar1.Marks.Style                 = MarksStyles.LabelValue;
            this.bar1.OffsetPercent               = -10;
            this.bar1.OriginalCursor              = null;
            this.bar1.Pen.Color                   = Color.FromArgb(255, ((int)(((byte)(132)))), ((int)(((byte)(55)))), ((int)(((byte)(3)))));
            this.bar1.Pen.Visible                 = false;
            this.bar1.Title                       = "Series0";
            this.bar1.XValues.Order               = ValueListOrder.Ascending;
            this.bar1.YValues.DataMember          = "Bar";
            this.bar2.BarRound                    = BarRounding.AtValue;
            this.bar2.BarStyle                    = BarStyles.RoundRectangle;
            this.bar2.BarWidthPercent             = 80;
            this.bar2.Brush.Color                 = Color.FromArgb(255, ((int)(((byte)(255)))), ((int)(((byte)(172)))), ((int)(((byte)(0)))));
            this.bar2.Color                       = Color.FromArgb(255, ((int)(((byte)(255)))), ((int)(((byte)(172)))), ((int)(((byte)(0)))));
            this.bar2.ColorEach                   = false;
            this.bar2.Marks.Arrow.Visible         = false;
            this.bar2.Marks.ArrowLength           = 8;
            this.bar2.Marks.Brush.Color           = Color.FromArgb(255, ((int)(((byte)(255)))), ((int)(((byte)(172)))), ((int)(((byte)(0)))));
            this.bar2.Marks.FollowSeriesColor     = true;
            this.bar2.Marks.Font.Brush.Color      = Colors.White;
            this.bar2.Marks.Font.Name             = "Segoe UI";
            this.bar2.Marks.Pen.Color             = Color.FromArgb(255, ((int)(((byte)(255)))), ((int)(((byte)(172)))), ((int)(((byte)(0)))));
            this.bar2.Marks.Pen.Visible           = false;
            this.bar2.Marks.Shadow.Visible        = false;
            this.bar2.Marks.Style                 = MarksStyles.LabelValue;
            this.bar2.Marks.Symbol.Shadow.Visible = false;
            this.bar2.OffsetPercent               = 10;
            this.bar2.OriginalCursor              = null;
            this.bar2.Pen.Color                   = Color.FromArgb(255, ((int)(((byte)(153)))), ((int)(((byte)(103)))), ((int)(((byte)(0)))));
            this.bar2.Pen.Visible                 = false;
            this.bar2.Title                       = "Series1";
            this.bar2.XValues.Order               = ValueListOrder.Ascending;
            this.bar2.YValues.DataMember          = "Bar";
            //this.seriesAnimation1.StartValue = 0D;
            this.chartPartAnimation1.Axis           = null;
            quadraticEase1.EasingMode               = EasingMode.EaseIn;
            this.chartPartAnimation1.EasingFunction = quadraticEase1;
            this.chartPartAnimation1.EasingMode     = EasingMode.EaseOut;
            this.chartPartAnimation1.Fade           = TransformFade.In;
            this.chartPartAnimation1.RotateMax      = 0F;
            this.chartPartAnimation1.RotateMin      = 0F;
            //this.chartPartAnimation1.Series = this.bar1;
            this.chartPartAnimation1.Speed          = 3000;
            this.chartPartAnimation1.Target         = ChartClickedPartStyle.Series;
            this.chartPartAnimation1.TranslateStyle = TransformTranslate.None;
            this.chartPartAnimation1.ZoomStyle      = TransformZoom.None;

            tChart1.Panel.Gradient.Visible = false;
            tChart1.Series.Add(bar1);
            tChart1.Series.Add(bar2);

            //add series and data
            bar1.Title = "Apples";
            bar1.Clear();
            bar1.Add(5, "jan");
            bar1.Add(2, "feb");
            bar1.Add(1, "mar");
            bar1.Add(4, "apr");
            bar1.Add(10, "may");
            bar1.Add(11, "jun");
            bar1.Add(15, "jul");

            bar2.Title = "Pears";
            bar2.Clear();
            bar2.Add(7);
            bar2.Add(5);
            bar2.Add(1);
            bar2.Add(6);
            bar2.Add(2);
            bar2.Add(11);
            bar2.Add(5);

            tChart1.Axes.Bottom.Labels.Style = AxisLabelStyle.Text;
            tChart1.Axes.Left.Increment      = 3;

            tChart1.Axes.Left.SetMinMax(0, 15);

            tChart1.Aspect.GestureOptions = Aspect.Gestures.None;

            chartPartAnimation1.Trigger = AnimationTrigger.MouseOver;
        }
コード例 #22
0
        public ColumnBarChart(ChartView BaseChart)
        {
            bar1           = new Bar();
            bar2           = new Bar();
            bar3           = new Bar();
            var            = new Variables.Variables();
            this.BaseChart = BaseChart;

            BaseChart.Chart.Legend.Visible = true;
            BaseChart.Chart.Header.Text    = "Civil status of people in the bus";
            BaseChart.Chart.Series.Add(bar1);
            BaseChart.Chart.Series.Add(bar2);
            BaseChart.Chart.Series.Add(bar3);

            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            = "Bus 1";
            bar1.DefaultNullValue = 0;
            for (int i = 0; i < var.GetValorColumn1.Length; i++)
            {
                bar1.Add(var.GetValorColumn1[i], var.GetValorColumnX[i]);
            }
            bar1.MarksOnBar      = true;
            bar1.Marks.Style     = MarksStyles.Value;
            bar1.BarWidthPercent = 80;
            bar1.VertAxis        = VerticalAxis.Both;
            bar1.HorizAxis       = HorizontalAxis.Both;

            bar2.Colors = new ColorList {
                var.GetPaletteBasic[1]
            };
            bar2.SeriesColor         = var.GetPaletteBasic[1];
            bar2.Chart.Zoom.Allow    = false;
            bar2.Chart.Panning.Allow = ScrollModes.None;
            bar2.RecalcOptions       = RecalcOptions.OnModify;
            bar2.Title            = "Bus 2";
            bar2.DefaultNullValue = 0;
            for (int i = 0; i < var.GetValorColumn2.Length; i++)
            {
                bar2.Add(var.GetValorColumn2[i], var.GetValorColumnX[i]);
            }
            bar2.ZOrder          = 0;
            bar2.MarksOnBar      = true;
            bar2.Marks.Style     = MarksStyles.Value;
            bar2.BarWidthPercent = 80;
            bar2.VertAxis        = VerticalAxis.Both;
            bar2.HorizAxis       = HorizontalAxis.Both;

            bar3.Colors = new ColorList {
                var.GetPaletteBasic[2]
            };
            bar3.SeriesColor         = var.GetPaletteBasic[2];
            bar3.Chart.Zoom.Allow    = false;
            bar3.Chart.Panning.Allow = ScrollModes.None;
            bar3.RecalcOptions       = RecalcOptions.OnModify;
            bar3.Title            = "Bus 3";
            bar3.DefaultNullValue = 0;
            for (int i = 0; i < var.GetValorColumn3.Length; i++)
            {
                bar3.Add(var.GetValorColumn3[i], var.GetValorColumnX[i]);
            }
            bar3.MarksOnBar      = true;
            bar3.Marks.Style     = MarksStyles.Value;
            bar3.BarWidthPercent = 80;
            bar3.VertAxis        = VerticalAxis.Both;
            bar3.HorizAxis       = HorizontalAxis.Both;

            BaseChart.Chart.Axes.Left.SetMinMax(BaseChart.Chart.Axes.Left.MinYValue, BaseChart.Chart.Axes.Left.MaxYValue + 1);
            BaseChart.Chart.Axes.Bottom.SetMinMax(BaseChart.Chart.Axes.Bottom.MinXValue, BaseChart.Chart.Axes.Bottom.MaxXValue);
            BaseChart.Chart.Axes.Left.Title   = null;
            BaseChart.Chart.Axes.Bottom.Title = null;
            BaseChart.Chart.Axes.Left.Visible = false;
            BaseChart.Chart.Axes.Bottom.Labels.ValueFormat = "0";
            BaseChart.Chart.Axes.Left.Labels.ValueFormat   = "0";
            BaseChart.Chart.Axes.Bottom.Grid.Visible       = false;
            BaseChart.Chart.Axes.Left.Increment            = 2;
            BaseChart.Chart.Legend.LegendStyle             = LegendStyles.Series;
            //BaseChart.Chart.ClickSeries += Chart_ClickSeries;
            BaseChart.Chart.Axes.Left.Labels.CustomSize = 0;

            // Themes Marks
            Themes.AplicarMarksTheme1(BaseChart);

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

            bar1.Marks.Pen.Visible = false;
            bar2.Marks.Pen.Visible = false;
            bar3.Marks.Pen.Visible = false;

            BaseChart.Chart.Series[0].Marks.TextAlign = Xamarin.Forms.TextAlignment.Center;
            BaseChart.Chart.Series[0].Marks.AutoSize  = true;
            BaseChart.Chart.Series[0].Marks.Color     = Color.Transparent;
            BaseChart.Chart.Series[1].Marks.TextAlign = Xamarin.Forms.TextAlignment.Center;
            BaseChart.Chart.Series[1].Marks.AutoSize  = true;
            BaseChart.Chart.Series[1].Marks.Color     = Color.Transparent;
            BaseChart.Chart.Series[2].Marks.TextAlign = Xamarin.Forms.TextAlignment.Center;
            BaseChart.Chart.Series[2].Marks.AutoSize  = true;
            BaseChart.Chart.Series[2].Marks.Color     = Color.Transparent;
            BaseChart.Chart.Panel.MarginLeft          = 5;

            //BaseChart.Chart.AfterDraw += Chart_AfterDrawAsync;
        }
コード例 #23
0
        private void InitializeChart()
        {
            this.tChart1.Series.Add(bar1);
            this.tChart1.Series.Add(bar2);
            this.tChart1.Series.Add(bar3);
            this.tChart1.Aspect.GestureOptions               = Aspect.Gestures.None;
            this.tChart1.Aspect.ColorPaletteIndex            = 20;
            this.tChart1.Aspect.View3D                       = false;
            this.tChart1.Axes.Bottom.Grid.DrawEvery          = 2;
            this.tChart1.Axes.Bottom.Grid.Visible            = false;
            this.tChart1.Axes.Bottom.Labels.Font.Brush.Color = Color.FromArgb(255, ((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
            this.tChart1.Axes.Bottom.Labels.Font.Size        = 9;
            this.tChart1.Axes.Bottom.Title.Font.Brush.Color  = Color.FromArgb(255, ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
            this.tChart1.Axes.Bottom.Title.Font.Size         = 11;
            this.tChart1.Axes.Left.AxisPen.Visible           = false;
            this.tChart1.Axes.Left.Grid.DrawEvery            = 2;
            this.tChart1.Axes.Left.Grid.Style                = DashStyles.Solid;
            this.tChart1.Axes.Left.Labels.Font.Brush.Color   = Colors.Gray;
            this.tChart1.Axes.Left.Labels.Font.Size          = 9;
            this.tChart1.Axes.Left.MinorTicks.Visible        = false;
            this.tChart1.Axes.Left.Ticks.Visible             = false;
            this.tChart1.Axes.Left.Title.Caption             = "$ 000s";
            this.tChart1.Axes.Left.Title.Font.Brush.Color    = Color.FromArgb(255, ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
            this.tChart1.Axes.Left.Title.Font.Size           = 11;
            this.tChart1.Axes.Left.Title.Lines               = new string[] {
                "$ 000s"
            };
            this.tChart1.Axes.Right.AxisPen.Visible         = false;
            this.tChart1.Axes.Right.Increment               = 5D;
            this.tChart1.Axes.Right.Labels.Font.Brush.Color = Color.FromArgb(255, ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
            this.tChart1.Axes.Right.Labels.Font.Size        = 9;
            this.tChart1.Axes.Right.Title.Caption           = "Billions";
            this.tChart1.Axes.Right.Title.Lines             = new string[] {
                "Billions"
            };
            this.tChart1.Axes.Top.Labels.Font.Brush.Color = Color.FromArgb(255, ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
            this.tChart1.Axes.Top.Labels.Font.Size        = 9;
            this.tChart1.CurrentTheme            = ThemeType.Lookout;
            this.tChart1.Footer.Alignment        = TextAlignment.Left;
            this.tChart1.Footer.Font.Brush.Color = Colors.Black;
            this.tChart1.Footer.Font.Italic      = true;
            this.tChart1.Footer.Font.Name        = "Segoe UI";
            this.tChart1.Footer.Lines            = new string[] {
                "Source : BI Intelligence estimates, Interactive Advertising Bureau"
            };
            this.tChart1.Footer.Visible          = true;
            this.tChart1.Header.Font.Brush.Color = Colors.Gray;
            this.tChart1.Header.Font.Size        = 12;
            this.tChart1.Header.Lines            = new string[] {
                "Native Advertising Revenue"
            };
            this.tChart1.Legend.Alignment        = LegendAlignments.Top;
            this.tChart1.Legend.Font.Brush.Color = Color.FromArgb(255, ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
            this.tChart1.Legend.Pen.Visible      = false;
            this.tChart1.Legend.Shadow.Visible   = false;
            this.tChart1.Legend.Transparent      = true;
            this.tChart1.Name = "tChart1";
            this.tChart1.Panel.Bevel.Outer            = BevelStyles.None;
            this.tChart1.Panel.Bevel.Width            = 2;
            this.tChart1.Panel.BevelWidth             = 2;
            this.tChart1.Panel.Brush.Color            = Color.FromArgb(255, ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
            this.tChart1.Panel.Brush.Gradient.Visible = false;
            this.tChart1.Series.Add(this.bar1);
            this.tChart1.Series.Add(this.bar2);
            this.tChart1.Series.Add(this.bar3);
            this.tChart1.SubHeader.Font.Brush.Color = Color.FromArgb(255, ((int)(((byte)(157)))), ((int)(((byte)(157)))), ((int)(((byte)(157)))));
            this.tChart1.SubHeader.Lines            = new string[] {
                "Desktop and Mobile"
            };
            this.tChart1.SubHeader.Visible        = true;
            this.tChart1.TabIndex                 = 0;
            this.tChart1.Walls.Back.Brush.Visible = false;
            this.tChart1.Walls.Back.Transparent   = true;
            this.tChart1.Walls.Back.Visible       = false;
            this.tChart1.GetAxisLabel            += TChart1_GetAxisLabel;
            this.bar1.Brush.Color                 = Color.FromArgb(255, ((int)(((byte)(68)))), ((int)(((byte)(102)))), ((int)(((byte)(163)))));
            this.bar1.Color                   = Color.FromArgb(255, ((int)(((byte)(68)))), ((int)(((byte)(102)))), ((int)(((byte)(163)))));
            this.bar1.ColorEach               = false;
            this.bar1.Marks.Arrow.Visible     = false;
            this.bar1.Marks.ArrowLength       = 8;
            this.bar1.Marks.Brush.Color       = Color.FromArgb(255, ((int)(((byte)(68)))), ((int)(((byte)(102)))), ((int)(((byte)(163)))));
            this.bar1.Marks.FollowSeriesColor = true;
            this.bar1.Marks.Font.Brush.Color  = Colors.White;
            this.bar1.Marks.Pen.Color         = Color.FromArgb(255, ((int)(((byte)(68)))), ((int)(((byte)(102)))), ((int)(((byte)(163)))));
            this.bar1.Marks.Shadow.Visible    = false;
            this.bar1.MultiBar                = MultiBars.Stacked;
            this.bar1.OriginalCursor          = null;
            this.bar1.Pen.Color               = Color.FromArgb(255, ((int)(((byte)(41)))), ((int)(((byte)(61)))), ((int)(((byte)(98)))));
            this.bar1.Title                   = "Native-Style Display";
            this.bar1.VertAxis                = VerticalAxis.Right;
            this.bar1.XValues.Order           = ValueListOrder.Ascending;
            this.bar1.GetSeriesMark          += Bar1_GetSeriesMark;
            this.bar2.Brush.Color             = Color.FromArgb(255, ((int)(((byte)(243)))), ((int)(((byte)(156)))), ((int)(((byte)(53)))));
            this.bar2.Color                   = Color.FromArgb(255, ((int)(((byte)(243)))), ((int)(((byte)(156)))), ((int)(((byte)(53)))));
            this.bar2.ColorEach               = false;
            this.bar2.Marks.Arrow.Visible     = false;
            this.bar2.Marks.ArrowLength       = 8;
            this.bar2.Marks.Brush.Color       = Color.FromArgb(255, ((int)(((byte)(243)))), ((int)(((byte)(156)))), ((int)(((byte)(53)))));
            this.bar2.Marks.FollowSeriesColor = true;
            this.bar2.Marks.Font.Brush.Color  = Colors.White;
            this.bar2.Marks.Pen.Color         = Color.FromArgb(255, ((int)(((byte)(243)))), ((int)(((byte)(156)))), ((int)(((byte)(53)))));
            this.bar2.Marks.Shadow.Visible    = false;
            this.bar2.MultiBar                = MultiBars.Stacked;
            this.bar2.OriginalCursor          = null;
            this.bar2.Pen.Color               = Color.FromArgb(255, ((int)(((byte)(146)))), ((int)(((byte)(94)))), ((int)(((byte)(32)))));
            this.bar2.Title                   = "Sponsorship";
            this.bar2.VertAxis                = VerticalAxis.Right;
            this.bar2.XValues.Order           = ValueListOrder.Ascending;
            this.bar3.BarRound                = BarRounding.AtValue;
            this.bar3.BarStyle                = BarStyles.RoundRectangle;
            this.bar3.Brush.Color             = Color.FromArgb(255, ((int)(((byte)(241)))), ((int)(((byte)(76)))), ((int)(((byte)(20)))));
            this.bar3.Color                   = Color.FromArgb(255, ((int)(((byte)(241)))), ((int)(((byte)(76)))), ((int)(((byte)(20)))));
            this.bar3.ColorEach               = false;
            this.bar3.Marks.Arrow.Visible     = false;
            this.bar3.Marks.ArrowLength       = 8;
            this.bar3.Marks.Brush.Color       = Color.FromArgb(255, ((int)(((byte)(241)))), ((int)(((byte)(76)))), ((int)(((byte)(20)))));
            this.bar3.Marks.FollowSeriesColor = true;
            this.bar3.Marks.Font.Brush.Color  = Colors.White;
            this.bar3.Marks.Pen.Color         = Color.FromArgb(255, ((int)(((byte)(241)))), ((int)(((byte)(76)))), ((int)(((byte)(20)))));
            this.bar3.Marks.Shadow.Visible    = false;
            this.bar3.MultiBar                = MultiBars.Stacked;
            this.bar3.OriginalCursor          = null;
            this.bar3.Pen.Color               = Color.FromArgb(255, ((int)(((byte)(145)))), ((int)(((byte)(46)))), ((int)(((byte)(12)))));
            this.bar3.Title                   = "Social";
            this.bar3.VertAxis                = VerticalAxis.Right;
            this.bar3.XValues.Order           = ValueListOrder.Ascending;

            tChart1.Panel.Gradient.Visible = false;

            bar1.Add(1);
            bar1.Add(1.3);
            bar1.Add(1.9);
            bar1.Add(2.7);
            bar1.Add(3.9);
            bar1.Add(5.7);

            bar2.Add(0.8);
            bar2.Add(1);
            bar2.Add(1.3);
            bar2.Add(2);
            bar2.Add(2.7);
            bar2.Add(3.4);

            bar3.Add(2.9);
            bar3.Add(5.6);
            bar3.Add(7.5);
            bar3.Add(9.2);
            bar3.Add(10.7);
            bar3.Add(11.9);
        }
コード例 #24
0
        // LiveCharts

        public ChartViewModel()
        {
            Bar.Add(new ChartModel()
            {
                Name = "Work time", Color = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#019c7c")), WorkTimeSpan = new TimeSpan(6, 30, 0), ImagePath = "M12,20A7,7 0 0,1 5,13A7,7 0 0,1 12,6A7,7 0 0,1 19,13A7,7 0 0,1 12,20M19.03,7.39L20.45,5.97C20,5.46 19.55,5 19.04,4.56L17.62,6C16.07,4.74 14.12,4 12,4A9,9 0 0,0 3,13A9,9 0 0,0 12,22C17,22 21,17.97 21,13C21,10.88 20.26,8.93 19.03,7.39M11,14H13V8H11M15,1H9V3H15V1Z"
            });
            Bar.Add(new ChartModel()
            {
                Name = "Break", Color = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#e8ba53")), WorkTimeSpan = new TimeSpan(1, 10, 0), ImagePath = "M2,21H20V19H2M20,8H18V5H20M20,3H4V13A4,4 0 0,0 8,17H14A4,4 0 0,0 18,13V10H20A2,2 0 0,0 22,8V5C22,3.89 21.1,3 20,3Z"
            });
            Bar.Add(new ChartModel()
            {
                Name = "Lunch", Color = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#23c4bf")), WorkTimeSpan = new TimeSpan(0, 45, 0), ImagePath = "M15.5,21L14,8H16.23L15.1,3.46L16.84,3L18.09,8H22L20.5,21H15.5M5,11H10A3,3 0 0,1 13,14H2A3,3 0 0,1 5,11M13,18A3,3 0 0,1 10,21H5A3,3 0 0,1 2,18H13M3,15H8L9.5,16.5L11,15H12A1,1 0 0,1 13,16A1,1 0 0,1 12,17H3A1,1 0 0,1 2,16A1,1 0 0,1 3,15Z"
            });
            Bar.Add(new ChartModel()
            {
                Name = "Meeting", Color = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#008eb3")), WorkTimeSpan = new TimeSpan(0, 30, 0), ImagePath = "M4,15H6A2,2 0 0,1 8,17V19H9V17A2,2 0 0,1 11,15H13A2,2 0 0,1 15,17V19H16V17A2,2 0 0,1 18,15H20A2,2 0 0,1 22,17V19H23V22H1V19H2V17A2,2 0 0,1 4,15M11,7L15,10L11,13V7M4,2H20A2,2 0 0,1 22,4V13.54C21.41,13.19 20.73,13 20,13V4H4V13C3.27,13 2.59,13.19 2,13.54V4A2,2 0 0,1 4,2Z"
            });
            Bar.Add(new ChartModel()
            {
                Name = "Study", Color = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#f4656d")), WorkTimeSpan = new TimeSpan(0, 20, 0), ImagePath = "M12,3L1,9L12,15L21,10.09V17H23V9M5,13.18V17.18L12,21L19,17.18V13.18L12,17L5,13.18Z"
            });
            Bar.Add(new ChartModel()
            {
                Name = "Exit note", Color = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#a7bfd0")), WorkTimeSpan = new TimeSpan(0, 10, 0), ImagePath = "M12,15H10V13H12V15M18,15H14V13H18V15M8,11H6V9H8V11M18,11H10V9H18V11M20,20H4A2,2 0 0,1 2,18V6A2,2 0 0,1 4,4H20A2,2 0 0,1 22,6V18A2,2 0 0,1 20,20M4,6V18H20V6H4Z"
            });
            Bar.Add(new ChartModel()
            {
                Name = "To the doctor", Color = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#bb8f5b")), WorkTimeSpan = new TimeSpan(0, 10, 0), ImagePath = "M18,18.5A1.5,1.5 0 0,0 19.5,17A1.5,1.5 0 0,0 18,15.5A1.5,1.5 0 0,0 16.5,17A1.5,1.5 0 0,0 18,18.5M19.5,9.5H17V12H21.46L19.5,9.5M6,18.5A1.5,1.5 0 0,0 7.5,17A1.5,1.5 0 0,0 6,15.5A1.5,1.5 0 0,0 4.5,17A1.5,1.5 0 0,0 6,18.5M20,8L23,12V17H21A3,3 0 0,1 18,20A3,3 0 0,1 15,17H9A3,3 0 0,1 6,20A3,3 0 0,1 3,17H1V6C1,4.89 1.89,4 3,4H17V8H20M8,6V9H5V11H8V14H10V11H13V9H10V6H8Z"
            });

            //Users.Add(new ChartModel() { Employee = "Мусійовський Андрій", Department = "ДПК", WorkTimeSpan = new TimeSpan(8, 10, 0) }); // Наразі - для відображення в графіку
            //Users.Add(new ChartModel() { Employee = "Савка Тарас", Department = "ДПК", WorkTimeSpan = new TimeSpan(7, 59, 0) }); // Наразі - для відображення в графіку

            //SelectedItem = Users[0];

            foreach (var item in UserViewModel.UserInfo)
            {
                ChartSelectInfo.Add(new ChartModel()
                {
                    SelectedUser = item as User
                });
            }
            //SelectedChartInfo = ChartSelectInfo.First(o => o.SelectedUser.Login == Environment.UserName);
            SelectedChartInfo = ChartSelectInfo.First();


            //DtUser = ConnectBase.Select("SELECT * FROM " + ConnectBase.userBase);
            //for (int i = 0; i < DtUser.Rows.Count; i++)
            //{
            //    //NewUser = new User() { ID = (int)DtUser.Rows[i]["ID"], Login = DtUser.Rows[i]["Login"].ToString(), LastName = DtUser.Rows[i]["LastName"].ToString(), FirstName = DtUser.Rows[i]["FirstName"].ToString(), SurName = DtUser.Rows[i]["SurName"].ToString(), GroupName = DtUser.Rows[i]["GroupName"].ToString(), Position = DtUser.Rows[i]["Position"].ToString() };
            //    //UserInfo.Add(NewUser);
            //    UserInfo.Add(new User() { ID = (int)DtUser.Rows[i]["ID"], Login = DtUser.Rows[i]["Login"].ToString(), LastName = DtUser.Rows[i]["LastName"].ToString(), FirstName = DtUser.Rows[i]["FirstName"].ToString(), SurName = DtUser.Rows[i]["SurName"].ToString(), GroupName = DtUser.Rows[i]["GroupName"].ToString(), Position = DtUser.Rows[i]["Position"].ToString() });
            //}



            //ConnectBase.Select();
            Dt = ConnectBase.Select("SELECT UserBase.FirstName, Break_Type, Break_Notes, Start_Time, End_Time FROM " + ConnectBase.timeBase + ", UserBase WHERE TimeBase.User_ID = UserBase.ID"); // comboBoxUsers.Items[1].ToString()
            //Dt = ConnectBase.Select("SELECT * FROM " + ConnectBase.timeBase);

            //GetUsers();
            //UsersList.UserInfo


            // ----- LiveCharts
            PointLabel = chartPoint => string.Format("{0} ({1:P})", chartPoint.Y, chartPoint.Participation);

            SeriesCollection = new LiveCharts.SeriesCollection();

            foreach (var item in Bar)
            {
                TimeSpan timespan = new TimeSpan();
                int      index    = Bar.IndexOf(item);

                SeriesCollection.Add(new PieSeries {
                    Title  = Bar[index].Name + " - " + Bar[index].WorkTimeSpan,
                    Values = new ChartValues <ObservableValue> {
                        new ObservableValue(Bar[index].WorkTimeSpan.TotalMinutes)
                    },
                    DataLabels = true, LabelPoint = chartPoint => string.Format(@"{0:hh\:mm\:ss} ({1:P})", timespan = TimeSpan.FromMinutes(chartPoint.Y), chartPoint.Participation),
                });
            }
            // ----- LiveCharts


            //SeriesCollection = new SeriesCollection
            //{
            //    //new PieSeries { Title = Bar[0].Name, Values = new ChartValues<ObservableValue> { new ObservableValue(Bar[0].WorkTimeSpan.TotalMinutes) }, DataLabels = true},
            //    //new PieSeries { Title = Bar[1].Name, Values = new ChartValues<ObservableValue> { new ObservableValue(Bar[1].WorkTimeSpan.TotalMinutes) }, DataLabels = true},
            //    //new PieSeries { Title = Bar[2].Name, Values = new ChartValues<ObservableValue> { new ObservableValue(Bar[2].WorkTimeSpan.TotalMinutes) }, DataLabels = true},
            //    //new PieSeries { Title = Bar[3].Name, Values = new ChartValues<ObservableValue> { new ObservableValue(Bar[3].WorkTimeSpan.TotalMinutes) }, DataLabels = true},
            //    //new PieSeries { Title = Bar[4].Name, Values = new ChartValues<ObservableValue> { new ObservableValue(Bar[4].WorkTimeSpan.TotalMinutes) }, DataLabels = true},
            //    //new PieSeries { Title = Bar[5].Name, Values = new ChartValues<ObservableValue> { new ObservableValue(Bar[5].WorkTimeSpan.TotalMinutes) }, DataLabels = true},
            //    //new PieSeries { Title = Bar[6].Name, Values = new ChartValues<ObservableValue> { new ObservableValue(Bar[6].WorkTimeSpan.TotalMinutes) }, DataLabels = true}

            //};
        }
コード例 #25
0
        private void CreateChart(string key, List <BaseReport> values)
        {
            var first        = values.First();
            var filterName   = first.FilterName;
            var filterValue  = first.FilterValue;
            var wantedFilter = "";

            if (first.HasFilter())
            {
                wantedFilter = cbFilter.SelectedItem.ToString();
            }

            void AddSeries(string tag)
            {
                var actualValues = first.HasFilter() ? values.Where(x => x.FilterValue == wantedFilter) : values;
                IEnumerable <DateTime> dates;

                if (cbUTC.Checked)
                {
                    dates = actualValues.Select(x => x.TimeStamp).Select(y => y.UtcDateTime);
                    _tChart1.Axes.Bottom.Title.Text = "UTC DateTime";
                }
                else
                {
                    dates = actualValues.Select(x => x.TimeStamp).Select(y => y.LocalDateTime);
                    _tChart1.Axes.Bottom.Title.Text = "Local DateTime";
                }

                var valors = actualValues.Select(x => x.GetValue(tag));

                if (!cbNonZero.Checked || !valors.All(x => x == 0.0))
                {
                    var minMax = $" ({valors.Min()}; {valors.Max()})";

                    if (cbUseBarSeries.Checked)
                    {
                        var bar = new Bar(_tChart1.Chart)
                        {
                            Title = tag + minMax
                        };

                        bar.XValues.DateTime = true;
                        bar.Add(dates.ToArray(), valors.ToArray());
                        bar.Add(dates.ToArray(), valors.ToArray());
                        bar.Marks.Visible = false;

                        if (tag.StartsWith("%"))
                        {
                            bar.VertAxis = VerticalAxis.Right;
                        }
                    }
                    else
                    {
                        var line = new Line(_tChart1.Chart)
                        {
                            Title = tag + minMax
                        };

                        line.LinePen.Style    = (System.Drawing.Drawing2D.DashStyle)(_tChart1.Series.Count % 4);
                        line.LinePen.Width    = 2;
                        line.XValues.DateTime = true;
                        line.Add(dates.ToArray(), valors.ToArray());

                        if (tag.StartsWith("%"))
                        {
                            line.VertAxis = VerticalAxis.Right;
                        }
                    }
                }
            }

            _tChart1.Series.Clear();
            _tChart1.Header.Text       = key;
            _tChart1.SubHeader.Visible = false;

            if (first.HasFilter())
            {
                _tChart1.SubHeader.Text    = filterName + ": " + wantedFilter;
                _tChart1.SubHeader.Visible = true;
            }


            foreach (var tag in first.PropertyMap.Keys)
            {
                if (tag != filterName)
                {
                    AddSeries(tag);
                }
            }
        }