Ejemplo n.º 1
0
        /// <summary>
        /// SectorItem constructor.
        /// </summary>
        /// <param name="pValue">Pecentage value of this sector, 0~1.</param>
        /// <param name="pStartAngle">Start Angle of this sector.</param>
        /// <param name="pInnerRadius">Innner radius.</param>
        /// <param name="pOuterRadius">Outer radius.</param>
        /// <param name="pColor">Fill color of this item.</param>
        /// <param name="pIsShadow">Whether this sector is shadow.</param>
        public SectorItem(SectorData pValue, double pStartAngle, double pInnerRadius, double pOuterRadius, Color pColor, bool pIsShadow)
        {
          
            InitializeComponent();           
    
            // Verify params.
            if (pValue.Value < 0)
                throw (new Exception("Sector's value can't be less than 0."));
            if (pValue.Value > 1)
                throw (new Exception("Sector's value can't be greater than 1."));
            if (pInnerRadius < 0)
                throw (new Exception("Sector's innner radius can't be less than 0."));
            if (pOuterRadius <= pInnerRadius)
                throw (new Exception("Sector's outer radius can't be less or equal than inner radius."));

            // Set params.
            _value = pValue;
            _startAngle = pStartAngle;
            _displayAngle = -1 * AngleFromValue(_value.Value);    // move clockwise
            _innerRadius = pInnerRadius;
            _outerRadius = pOuterRadius;
            _color = pColor;

            // Shadow canvas.
            _isShadow = pIsShadow;

            Control_Loaded();


        }
Ejemplo n.º 2
0
        /// <summary>
        /// Verify & fill chart values.
        /// </summary>
        private void GetChartValue(SectorData[] sectors)
        {
        
            //JavaScriptSerializer jss = new JavaScriptSerializer();
            
            
            // --------------- Fill Dummy Data Here --------------------
            // fill inputData will actual data
            // ---------------------------------------------------------
            Collection<SectorData> inputData = new Collection<SectorData>();
            foreach (SectorData sector in sectors)
            {
                inputData.Add(sector);
            }
            //inputData.Add(new SectorData(0, "Title00", "Comment00", 0.23));
            //inputData.Add(new SectorData(1, "Title01", "Comment01", 0.1));
            //inputData.Add(new SectorData(2, "Title02", "Comment02", 0.1));
            //inputData.Add(new SectorData(3, "Title03", "Comment03", 0.09));
            //inputData.Add(new SectorData(4, "Title04", "Comment04", 0.08));
            //inputData.Add(new SectorData(5, "Title05", "Comment05", 0.08));
            //inputData.Add(new SectorData(6, "Title06", "Comment06", 0.08));
            //inputData.Add(new SectorData(7, "Title07", "Comment07", 0.08));
            //inputData.Add(new SectorData(8, "Title08", "Comment08", 0.13));
            //inputData.Add(new SectorData(9, "Title09", "Comment09", 0.03));

            // Verify data.
            VerifyData(inputData);

            // Sync caption color.
            SyncCaptionColor();
        }