Esempio n. 1
0
        private void CreateLeftGrid()
        {
            if (LeftPanel != null)
            {
                var leftGrid = GdiMapper.ToGdiGrid(ChartGridModel);
                leftGrid.CellSize = CellSize;
                leftGrid.Size     = LeftPanel.Size;
                leftGrid.IsDrawnFromRightToLeft = true;

                LeftPanel.AddChild(leftGrid);
            }
        }
Esempio n. 2
0
        private void AddBarSeries(DataSeries series, int offsetY)
        {
            var y = (CellSize.Height / 2) + offsetY;

            foreach (var value in series.Data)
            {
                var length = WidthUnit * value;

                var bar = new GdiRectangle
                {
                    Size            = new SizeF(Math.Abs(length), BarSettingModel.Size),
                    Margin          = new PointF(0, y),
                    BackgroundColor = series.Color,
                };

                var text = new GdiText
                {
                    Margin            = new PointF(bar.Size.Width + 2, 0),
                    Content           = string.Format(BarSettingModel.FormatValue, value),
                    Font              = BarSettingModel.ValueFont,
                    TextColor         = Color.Gray,
                    VerticalAlignment = GdiSharp.Enum.GdiVerticalAlign.Middle
                };

                if (length > 0)
                {
                    RightPanel.AddChild(bar);
                }
                else if (length < 0)
                {
                    LeftPanel.AddChild(bar);
                    bar.HorizontalAlignment  = GdiSharp.Enum.GdiHorizontalAlign.Right;
                    text.HorizontalAlignment = GdiSharp.Enum.GdiHorizontalAlign.Right;
                }

                bar.AddChild(text);

                y += CellSize.Height;
            }
        }