コード例 #1
0
 public CartesianChartCore(ICartesianChartView <TDrawingContext> view, Canvas <TDrawingContext> canvas)
 {
     this.canvas               = canvas;
     chartView                 = view;
     updateThrottler           = new ActionThrottler(TimeSpan.FromSeconds(300));
     updateThrottler.Unlocked += UpdateThrottlerUnlocked;
 }
コード例 #2
0
ファイル: CartesianChart.cs プロジェクト: ICU-UCI/LiveCharts2
 public CartesianChart(
     ICartesianChartView <TDrawingContext> view,
     Action <LiveChartsSettings> defaultPlatformConfig,
     Canvas <TDrawingContext> canvas)
     : base(canvas, defaultPlatformConfig)
 {
     chartView = view;
 }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SKCartesianChart"/> class.
 /// </summary>
 /// <param name="view">The view.</param>
 public SKCartesianChart(ICartesianChartView <SkiaSharpDrawingContext> view) : this()
 {
     XAxes           = view.XAxes;
     YAxes           = view.YAxes;
     Series          = view.Series;
     Sections        = view.Sections;
     DrawMarginFrame = view.DrawMarginFrame;
 }
コード例 #4
0
        public CartesianChart(
            ICartesianChartView <TDrawingContext> view,
            Action <LiveChartsSettings> defaultPlatformConfig,
            MotionCanvas <TDrawingContext> canvas)
            : base(canvas, defaultPlatformConfig)
        {
            chartView = view;

            view.PointStates.Chart = this;
            foreach (var item in view.PointStates.GetStates())
            {
                if (item.Fill != null)
                {
                    item.Fill.ZIndex += 1000000;
                    canvas.AddDrawableTask(item.Fill);
                }
                if (item.Stroke != null)
                {
                    item.Stroke.ZIndex += 1000000;
                    canvas.AddDrawableTask(item.Stroke);
                }
            }
        }
コード例 #5
0
        void IChartLegend <SkiaDrawingContext> .Draw(ICartesianChartView <SkiaDrawingContext> view)
        {
            var series            = view.Series;
            var legendOrientation = view.LegendOrientation;
            var legendPosition    = view.LegendPosition;

            Series = series;

            switch (legendPosition)
            {
            case LegendPosition.None:
                Visibility = Visibility.Collapsed;
                break;

            case LegendPosition.Top:
                Visibility = Visibility.Visible;
                if (legendOrientation == LegendOrientation.Auto)
                {
                    Orientation = Orientation.Horizontal;
                }
                Dock = Dock.Top;
                break;

            case LegendPosition.Left:
                Visibility = Visibility.Visible;
                if (legendOrientation == LegendOrientation.Auto)
                {
                    Orientation = Orientation.Vertical;
                }
                Dock = Dock.Left;
                break;

            case LegendPosition.Right:
                Visibility = Visibility.Visible;
                if (legendOrientation == LegendOrientation.Auto)
                {
                    Orientation = Orientation.Vertical;
                }
                Dock = Dock.Right;
                break;

            case LegendPosition.Bottom:
                Visibility = Visibility.Visible;
                if (legendOrientation == LegendOrientation.Auto)
                {
                    Orientation = Orientation.Horizontal;
                }
                Dock = Dock.Bottom;
                break;

            default:
                break;
            }

            if (legendOrientation != LegendOrientation.Auto)
            {
                Orientation = legendOrientation == LegendOrientation.Horizontal
                    ? Orientation.Horizontal
                    : Orientation.Vertical;
            }

            var wpfChart = (CartesianChart)view;

            FontFamily  = wpfChart.LegendFontFamily ?? new FontFamily("Trebuchet MS");
            TextColor   = wpfChart.LegendTextColor ?? new SolidColorBrush(Color.FromRgb(35, 35, 35));
            FontSize    = wpfChart.LegendFontSize ?? 13;
            FontWeight  = wpfChart.LegendFontWeight ?? FontWeights.Normal;
            FontStyle   = wpfChart.LegendFontStyle ?? FontStyles.Normal;
            FontStretch = wpfChart.LegendFontStretch ?? FontStretches.Normal;

            UpdateLayout();
        }