private void initMarker()
        {
            lineMarker             = new C1LineMarker(this);
            lineMarker.DragContent = true;
            layout             = new LinearLayout(this);
            layout.Orientation = Android.Widget.Orientation.Vertical;
            layout.SetPadding(10, 10, 10, 10);
            layout.SetBackgroundColor(Color.Gray);
            xLabel = new TextView(this);

            layout.AddView(xLabel);

            for (int index = 0; index < mChart.Series.Count; index++)
            {
                var      series = mChart.Series[index];
                var      fill   = (int)((IChart)mChart).GetColor(index);
                TextView yLabel = new TextView(this);
                var      bytes  = BitConverter.GetBytes(fill);
                yLabel.SetTextColor(new Color(fill));

                yLabels.Add(yLabel);
                layout.AddView(yLabel);
            }
            lineMarker.Content = layout;

            lineMarker.PositionChanged += LineMarker_PositionChanged;
        }
Пример #2
0
        private void SetupChart()
        {
            flexChart.ChartType  = ChartType.Column;
            flexChart.BindingX   = "Date";
            flexChart.Background = new SolidColorBrush(Colors.White);

            // setup common X Axis
            xAxis = new Axis
            {
                Format         = "d MMM",
                GroupProvider  = new MyDateTimeGroupProvider(),
                GroupSeparator = AxisGroupSeparator.Horizontal
            };

            flexChart.Header      = "Monthly Temperature (°F)";
            flexChart.HeaderStyle = new ChartStyle
            {
                FontSize = 25
            };
            //flexChart.Footer = "Copyright (c) GrapeCity";
            flexChart.SelectionMode = ChartSelectionMode.Series;
            flexChart.LegendToggle  = true;

            flexChart.ToolTip = null;


            annotationLayer = new AnnotationLayer();
            flexChart.Layers.Add(annotationLayer);

            lineMarker = new C1LineMarker
            {
                LineWidth = 2,
                LineBrush = new SolidColorBrush(Colors.Gray)
            };
            lineMarker.PositionChanged += OnLineMarkerPositionChanged;
            flexChart.Layers.Add(lineMarker);

            flexChart.Rendered  += FlexChart_Rendered;
            flexChart.Rendering += FlexChart_Rendering;

            flexChart.AnimationSettings  = AnimationSettings.Load;
            flexChart.AnimationLoad.Type = AnimationType.Series;

            //flexChart.Palette = Palette.Cerulean;

            flexChart.LegendGroupHeaderStyle = new ChartStyle
            {
                FontWeight = FontWeights.Bold,
                FontSize   = 14,
                Stroke     = new SolidColorBrush(Color.FromRgb(82, 82, 82))
            };
        }
        private void initMarker()
        {
            lineMarker             = new C1LineMarker();
            lineMarker.DragContent = true;
            UIView view = new UIView(new CGRect(0, 0, 110, 70));

            xLabel = new UILabel(new CGRect(5, 5, 110, 20));
            view.Add(xLabel);
            view.BackgroundColor = UIColor.FromRGBA(0.53f, 0.53f, 0.53f, 1.00f);
            for (int index = 0; index < chart.Series.Count; index++)
            {
                var     series = chart.Series[index];
                var     fill   = ((IChart)chart).GetColor(index);
                UILabel yLabel = new UILabel(new CGRect(5, 25 + 20 * index, 110, 20));
                yLabels.Add(yLabel);
                yLabel.TextColor = index == 0 ? UIColor.FromRGBA(0.53f, 0.67f, 0.78f, 1.00f) : UIColor.FromRGBA(0.89f, 0.66f, 0.38f, 1.00f);
                view.Add(yLabel);
            }
            lineMarker.Content          = view;
            lineMarker.PositionChanged += LineMarker_PositionChanged;
        }
Пример #4
0
        private void SetupChart()
        {
            flexChart.ChartType  = ChartType.Column;
            flexChart.BindingX   = "Date";
            flexChart.Background = new SolidColorBrush(Colors.White);

            // setup common X Axis
            xAxis = new Axis
            {
                Format         = "d MMM",
                GroupProvider  = new MyDateTimeGroupProvider(),
                GroupSeparator = AxisGroupSeparator.Horizontal
            };

            flexChart.Header      = "Monthly Temperature (°F)";
            flexChart.HeaderStyle = new ChartStyle
            {
                FontSize = 25
            };
            //flexChart.Footer = "Copyright (c) GrapeCity";
            flexChart.SelectionMode = ChartSelectionMode.Series;
            flexChart.LegendToggle  = true;

            flexChart.ToolTip = null;


            annotationLayer = new AnnotationLayer();
            flexChart.Layers.Add(annotationLayer);

            al = new EditableAnnotationLayer(flexChart)
            {
                ContentEditor = new AnnotationEditor()
            };
            al.PolygonAddFunc = (pt) =>
            {
                return(new Polygon(string.Empty)
                {
                    Points =
                    {
                        pt, pt, pt
                    }
                });
            };
            al.PolygonReSizeFunc = (poly, rectangle) =>
            {
                var top   = new Point((float)(rectangle.Left + rectangle.Width / 2), rectangle.Y);
                var left  = new Point(rectangle.Left, rectangle.Bottom);
                var right = new Point(rectangle.Right, rectangle.Bottom);
                poly.Points[0] = Helpers.CoordsToAnnoPoint(flexChart, poly, top);
                poly.Points[1] = Helpers.CoordsToAnnoPoint(flexChart, poly, left);
                poly.Points[2] = Helpers.CoordsToAnnoPoint(flexChart, poly, right);
            };
            flexChart.Layers.Add(al);

            lineMarker = new C1LineMarker
            {
                LineWidth = 2,
                LineBrush = new SolidColorBrush(Colors.Gray)
            };
            lineMarker.PositionChanged += OnLineMarkerPositionChanged;
            flexChart.Layers.Add(lineMarker);

            flexChart.Rendered  += FlexChart_Rendered;
            flexChart.Rendering += FlexChart_Rendering;
            flexChart.MouseDown += FlexChart_MouseDown;
            flexChart.KeyDown   += FlexChart_KeyDown;

            flexChart.AnimationSettings  = AnimationSettings.Load;
            flexChart.AnimationLoad.Type = AnimationType.Series;

            //flexChart.Palette = Palette.Cerulean;

            flexChart.LegendGroupHeaderStyle = new ChartStyle
            {
                FontWeight = FontWeights.Bold,
                FontSize   = 14,
                Stroke     = new SolidColorBrush(Color.FromRgb(82, 82, 82))
            };
        }