Example #1
0
        Matrix _ChartMatrix;                    // Pseudo matrix to calculate chart data

        internal Chart(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p, xNode)
        {
            _Type               = ChartTypeEnum.Column;
            _Subtype            = ChartSubTypeEnum.Plain;
            _SeriesGroupings    = null;
            _CategoryGroupings  = null;
            _ChartData          = null;
            _Legend             = null;
            _CategoryAxis       = null;
            _ValueAxis          = null;
            _Title              = null;
            _PointWidth         = 0;
            _Palette            = ChartPaletteEnum.Default;
            _ThreeDProperties   = null;
            _PlotArea           = null;
            _ChartElementOutput = ChartElementOutputEnum.Output;

            // Loop thru all the child nodes
            foreach (XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                {
                    continue;
                }
                switch (xNodeLoop.Name)
                {
                case "Type":
                    _Type = ChartType.GetStyle(xNodeLoop.InnerText);
                    if (_Type == ChartTypeEnum.Stock ||
                        _Type == ChartTypeEnum.Unknown)
                    {
                        OwnerReport.rl.LogError(8, "Chart type '" + xNodeLoop.InnerText + "' is not currently supported.");
                    }
                    break;

                case "Subtype":
                    _Subtype = ChartSubType.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                case "SeriesGroupings":
                    _SeriesGroupings = new SeriesGroupings(r, this, xNodeLoop);
                    break;

                case "CategoryGroupings":
                    _CategoryGroupings = new CategoryGroupings(r, this, xNodeLoop);
                    break;

                case "ChartData":
                    _ChartData = new ChartData(r, this, xNodeLoop);
                    break;

                case "Legend":
                    _Legend = new Legend(r, this, xNodeLoop);
                    break;

                case "CategoryAxis":
                    _CategoryAxis = new CategoryAxis(r, this, xNodeLoop);
                    break;

                case "ValueAxis":
                    _ValueAxis = new ValueAxis(r, this, xNodeLoop);
                    break;

                case "Title":
                    _Title = new Title(r, this, xNodeLoop);
                    break;

                case "PointWidth":
                    _PointWidth = XmlUtil.Integer(xNodeLoop.InnerText);
                    break;

                case "Palette":
                    _Palette = ChartPalette.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                case "ThreeDProperties":
                    _ThreeDProperties = new ThreeDProperties(r, this, xNodeLoop);
                    break;

                case "PlotArea":
                    _PlotArea = new PlotArea(r, this, xNodeLoop);
                    break;

                case "ChartElementOutput":
                    _ChartElementOutput = fyiReporting.RDL.ChartElementOutput.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                default:
                    if (DataRegionElement(xNodeLoop))                                   // try at DataRegion level
                    {
                        break;
                    }
                    // don't know this element - log it
                    OwnerReport.rl.LogError(4, "Unknown Chart element '" + xNodeLoop.Name + "' ignored.");
                    break;
                }
            }
            DataRegionFinish();                                 // Tidy up the DataRegion

            if (_SeriesGroupings == null && _CategoryGroupings == null)
            {
                OwnerReport.rl.LogError(8, "Chart requires either the SeriesGroupings element or CategoryGroupings element or both.");
            }

            if (OwnerReport.rl.MaxSeverity > 4)     // if we already have severe error don't check for these additional issues
            {
                return;
            }

            // Do some specific checking based on the type of the Chart specified
            switch (_Type)
            {
            case ChartTypeEnum.Bubble:
                if (_ChartData == null ||
                    _ChartData.Items[0].Datapoints.Items[0].DataValues.Items.Count != 3)
                {
                    OwnerReport.rl.LogError(8, "Bubble charts require three DataPoints defined.");
                }
                break;

            case ChartTypeEnum.Scatter:
                if (_ChartData == null ||
                    _ChartData.Items[0].Datapoints.Items[0].DataValues.Items.Count != 2)
                {
                    OwnerReport.rl.LogError(8, "Scatter charts require two DataPoints defined.");
                }
                break;

            default:
                break;
            }
        }
Example #2
0
        Matrix _ChartMatrix;                    // Pseudo matrix to calculate chart data

        internal Chart(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p, xNode)
        {
            _Type               = ChartTypeEnum.Column;
            _Subtype            = ChartSubTypeEnum.Plain;
            _SeriesGroupings    = null;
            _CategoryGroupings  = null;
            _ChartData          = null;
            _Legend             = null;
            _CategoryAxis       = null;
            _ValueAxis          = null;
            _Title              = null;
            _PointWidth         = 0;
            _Palette            = ChartPaletteEnum.Default;
            _ThreeDProperties   = null;
            _PlotArea           = null;
            _ChartElementOutput = ChartElementOutputEnum.Output;

            // Loop thru all the child nodes
            foreach (XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                {
                    continue;
                }
                switch (xNodeLoop.Name)
                {
                case "Type":
                    _Type = ChartType.GetStyle(xNodeLoop.InnerText);
                    if (_Type == ChartTypeEnum.Scatter ||
                        _Type == ChartTypeEnum.Bubble ||
                        _Type == ChartTypeEnum.Stock ||
                        _Type == ChartTypeEnum.Unknown)
                    {
                        OwnerReport.rl.LogError(8, "Chart type '" + xNodeLoop.InnerText + "' is not currently supported.");
                    }
                    break;

                case "Subtype":
                    _Subtype = ChartSubType.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                case "SeriesGroupings":
                    _SeriesGroupings = new SeriesGroupings(r, this, xNodeLoop);
                    break;

                case "CategoryGroupings":
                    _CategoryGroupings = new CategoryGroupings(r, this, xNodeLoop);
                    break;

                case "ChartData":
                    _ChartData = new ChartData(r, this, xNodeLoop);
                    break;

                case "Legend":
                    _Legend = new Legend(r, this, xNodeLoop);
                    break;

                case "CategoryAxis":
                    _CategoryAxis = new CategoryAxis(r, this, xNodeLoop);
                    break;

                case "ValueAxis":
                    _ValueAxis = new ValueAxis(r, this, xNodeLoop);
                    break;

                case "Title":
                    _Title = new Title(r, this, xNodeLoop);
                    break;

                case "PointWidth":
                    _PointWidth = XmlUtil.Integer(xNodeLoop.InnerText);
                    break;

                case "Palette":
                    _Palette = ChartPalette.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                case "ThreeDProperties":
                    _ThreeDProperties = new ThreeDProperties(r, this, xNodeLoop);
                    break;

                case "PlotArea":
                    _PlotArea = new PlotArea(r, this, xNodeLoop);
                    break;

                case "ChartElementOutput":
                    _ChartElementOutput = fyiReporting.RDL.ChartElementOutput.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                default:
                    if (DataRegionElement(xNodeLoop))                                   // try at DataRegion level
                    {
                        break;
                    }
                    // don't know this element - log it
                    OwnerReport.rl.LogError(4, "Unknown Chart element '" + xNodeLoop.Name + "' ignored.");
                    break;
                }
            }
            DataRegionFinish();                                 // Tidy up the DataRegion

            if (_SeriesGroupings == null && _CategoryGroupings == null)
            {
                OwnerReport.rl.LogError(8, "Chart requires either the SeriesGroupings element or CategoryGroupings element or both.");
            }
        }