Exemplo n.º 1
0
        /// <summary>
        /// Generates the conatiners.
        /// </summary>
        private void GenerateConatiners()
        {
            this.Children.Clear();
            this.Containers.Clear();
            if (XAxis != null && YAxis != null)
            {
                AxisLinesconatiner = new AxisCrossLinesContainer {
                    Height = this.ActualHeight, Width = this.ActualWidth
                };
                Binding xAxisBinding = new Binding {
                    Path = new PropertyPath("XAxis"), Source = this
                };
                Binding yAxisBinding = new Binding {
                    Source = this, Path = new PropertyPath("YAxis")
                };
                AxisLinesconatiner.SetBinding(AxisCrossLinesContainer.XAxisProperty, xAxisBinding);
                AxisLinesconatiner.SetBinding(AxisCrossLinesContainer.YAxisProperty, yAxisBinding);

                if (this.Chart != null && this.Chart.OverlayMode == OverlayMode.SeriesFirst)
                {
                    this.Children.Add(AxisLinesconatiner);
                }
            }
            if (this.Series != null)
            {
                foreach (var seriesBase in Series)
                {
                    SeriesContainer container = seriesBase.CreateContainer();
                    seriesBase.Height       = this.ActualHeight;
                    seriesBase.Width        = this.ActualWidth;
                    container.Series        = seriesBase;
                    container.Container     = this;
                    container.RenderingMode = this.RenderingMode;
#if WPF
                    container.dpiFactor = this.dpiFactor;
#endif
                    container.Collection = this;
                    switch (RenderingMode)
                    {
#if WPF
                    case RenderingMode.GDIRendering:
                        container.InteropBitmap = this.InteropBitmap;
                        container.GDIGraphics   = this.GDIGraphics;
                        break;

                    case RenderingMode.WritableBitmap:
                        container.WritableBitmap         = this.WritableBitmap;
                        container.WritableBitmapGraphics = this.WritableBitmapGraphics;
                        container.ImageBitmap            = this.ImageBitmap;
                        break;
#endif
                    case RenderingMode.Default:
                        this.Children.Add(container.PartsCanvas);
                        break;

#if DIRECTX2D
                    case Chart.RenderingMode.DirectX2D:
                        container.Directx2DGraphics = this.Directx2DGraphics;
                        container.RenderTarget      = this.RenderTarget;
                        break;
#endif

                    default:
                        break;
                    }

                    this.Containers.Add(container);
                }
            }

            this.Children.Add(bitmapImage);
            if (XAxis != null && YAxis != null)
            {
                if (this.Chart != null && this.Chart.OverlayMode == OverlayMode.AxisFirst)
                {
                    this.Children.Add(AxisLinesconatiner);
                }
            }
            _isIntialized = true;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Generates the conatiners.
        /// </summary>
        private void GenerateConatiners()
        {
            this.Children.Clear();
            this.Containers.Clear();
            if (XAxis != null && YAxis != null)
            {
                AxisLinesconatiner = new AxisCrossLinesContainer {Height = this.ActualHeight, Width = this.ActualWidth};
                Binding xAxisBinding = new Binding {Path = new PropertyPath("XAxis"), Source = this};
                Binding yAxisBinding = new Binding {Source = this, Path = new PropertyPath("YAxis")};
                AxisLinesconatiner.SetBinding(AxisCrossLinesContainer.XAxisProperty, xAxisBinding);
                AxisLinesconatiner.SetBinding(AxisCrossLinesContainer.YAxisProperty, yAxisBinding);

                if (this.Chart != null && this.Chart.OverlayMode == OverlayMode.SeriesFirst)
                    this.Children.Add(AxisLinesconatiner);
            }
            if(this.Series!=null)
                foreach (var seriesBase in Series)
                {
                    SeriesContainer container = seriesBase.CreateContainer();
                    seriesBase.Height = this.ActualHeight;
                    seriesBase.Width = this.ActualWidth;
                    container.Series = seriesBase;
                    container.Container = this;
                    container.RenderingMode = this.RenderingMode;
            #if WPF
                    container.dpiFactor = this.dpiFactor;
            #endif
                    container.Collection = this;
                    switch (RenderingMode)
                    {
            #if WPF
                        case RenderingMode.GDIRendering:
                            container.InteropBitmap = this.InteropBitmap;
                            container.GDIGraphics = this.GDIGraphics;
                            break;
                        case RenderingMode.WritableBitmap:
                            container.WritableBitmap = this.WritableBitmap;
                            container.WritableBitmapGraphics = this.WritableBitmapGraphics;
                            container.ImageBitmap = this.ImageBitmap;
                            break;
            #endif
                        case RenderingMode.Default:
                            this.Children.Add(container.PartsCanvas);
                            break;
            #if DIRECTX2D
                    case Chart.RenderingMode.DirectX2D:
                        container.Directx2DGraphics = this.Directx2DGraphics;
                        container.RenderTarget = this.RenderTarget;
                        break;
            #endif

                        default:
                            break;
                    }

                    this.Containers.Add(container);
                }

            this.Children.Add(bitmapImage);
            if (XAxis != null && YAxis != null)
            {
                if (this.Chart != null && this.Chart.OverlayMode == OverlayMode.AxisFirst)
                    this.Children.Add(AxisLinesconatiner);
            }
            _isIntialized = true;
        }