Exemplo n.º 1
0
        protected override void CreateEmptyOption()
        {
            if (emptyOption != null)
            {
                return;
            }

            UIPieOption option = new UIPieOption();

            option.Title         = new UITitle();
            option.Title.Text    = "SunnyUI";
            option.Title.SubText = "PieChart";

            var series = new UIPieSeries();

            series.Name   = "饼状图";
            series.Center = new UICenter(50, 55);
            series.Radius = 70;
            for (int i = 0; i < 5; i++)
            {
                series.AddData("Data" + i, (i + 1) * 20);
            }

            option.Series.Add(series);
            emptyOption = option;
        }
Exemplo n.º 2
0
        private float RadiusSize(UIPieSeries series)
        {
            int left = series.Center.Left;
            int top  = series.Center.Top;

            left = Width * left / 100;
            top  = Height * top / 100;
            return(Math.Min(Width, Height) * series.Radius / 200.0f);
        }
Exemplo n.º 3
0
        private Point DrawCenter(UIPieSeries series)
        {
            int left = series.Center.Left;
            int top  = series.Center.Top;

            left = Width * left / 100;
            top  = Height * top / 100;
            return(new Point(left, top));
        }
Exemplo n.º 4
0
        private RectangleF GetSeriesRect(UIPieSeries series)
        {
            int left = series.Center.Left;
            int top  = series.Center.Top;

            left = Width * left / 100;
            top  = Height * top / 100;
            float halfRadius = Math.Min(Width, Height) * series.Radius / 200.0f;

            return(new RectangleF(left - halfRadius, top - halfRadius, halfRadius * 2, halfRadius * 2));
        }
Exemplo n.º 5
0
 public void AddSeries(UIPieSeries series)
 {
     Series.Clear();
     Series.Add(series);
 }
Exemplo n.º 6
0
 private float RadiusSize(UIPieSeries series)
 {
     return(Math.Min(Width, Height) * series.Radius / 200.0f);
 }