Exemplo n.º 1
0
        /// <summary>
        /// Get sample chart break
        /// </summary>
        /// <returns>sample chart break</returns>
        public ChartBreak GetSampleChartBreak()
        {
            ChartBreak aCB = (ChartBreak)Clone();
            int        i;

            switch (aCB.ChartType)
            {
            case ChartTypes.BarChart:
                float min = aCB.MaxValue / aCB.ItemNum;
                float dv  = (aCB.MaxValue - min) / aCB.ItemNum;
                for (i = 0; i < aCB.ItemNum; i++)
                {
                    int    v = (int)(min + dv * i);
                    double n = Math.Pow(10, v.ToString().Length - 1);
                    v = Convert.ToInt32(Math.Floor(v / n) * n);
                    aCB.ChartData[i] = v;
                }
                break;

            case ChartTypes.PieChart:
                float sum  = (aCB.MaxValue - aCB.MinValue) * 2 / 3;
                float data = sum / aCB.ItemNum;
                for (i = 0; i < aCB.ItemNum; i++)
                {
                    aCB.ChartData[i] = data;
                }
                break;
            }

            return(aCB);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Update legend nodes using a legend scheme
        /// </summary>
        /// <param name="aLS">legend scheme</param>
        public void UpdateLegendScheme(LegendScheme aLS)
        {
            if (_mapLayer.LayerType != LayerTypes.ImageLayer)
            {
                _legendNodes.Clear();
                LegendNode aTN = new LegendNode();
                for (int i = 0; i < aLS.BreakNum; i++)
                {
                    if (aLS.LegendBreaks[i].DrawShape)
                    {
                        aTN             = new LegendNode();
                        aTN.ShapeType   = ShapeType;
                        aTN.LegendBreak = aLS.LegendBreaks[i];
                        _legendNodes.Add(aTN);
                    }
                }

                if (_mapLayer.LayerType == LayerTypes.VectorLayer)
                {
                    VectorLayer aLayer = (VectorLayer)_mapLayer;
                    if (aLayer.ChartSet.DrawCharts && aLayer.ChartPoints.Count > 0)
                    {
                        LegendNode aLN = new LegendNode();
                        aLN.ShapeType = ShapeTypes.Polygon;
                        ChartBreak aCB = ((ChartBreak)aLayer.ChartPoints[0].Legend).GetSampleChartBreak();
                        aLN.LegendBreak = aCB;
                        aLN.Height      = ((ChartBreak)aLN.LegendBreak).GetHeight() + 10;
                        _legendNodes.Add(aLN);
                        for (int i = 0; i < aLayer.ChartSet.LegendScheme.BreakNum; i++)
                        {
                            aLN             = new LegendNode();
                            aLN.ShapeType   = ShapeTypes.Polygon;
                            aLN.LegendBreak = aLayer.ChartSet.LegendScheme.LegendBreaks[i];
                            _legendNodes.Add(aLN);
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Override Clone method
        /// </summary>
        /// <returns>object</returns>
        public override object Clone()
        {
            ChartBreak aCB = new ChartBreak(_chartType);

            aCB.Caption      = this.Caption;
            aCB.AlignType    = _alignType;
            aCB.BarWidth     = _barWidth;
            aCB.ChartData    = new List <float>(_chartData);
            aCB.Color        = Color;
            aCB.DrawShape    = DrawShape;
            aCB.LegendScheme = _legendScheme;
            aCB.MaxSize      = _maxSize;
            aCB.MaxValue     = _maxValue;
            aCB.MinSize      = _minSize;
            aCB.MinValue     = _minValue;
            aCB.Thickness    = _thickness;
            aCB.View3D       = _view3D;
            aCB.XShift       = _xShift;
            aCB.YShift       = _yShift;

            return(aCB);
        }