Пример #1
0
        protected double GetDataValue(Report rpt, int row, int col)
        {
            MatrixCellEntry mce = _DataDefn[row, col];

            if (mce == null)
            {
                return(0);                                                      // Not sure what this really means TODO:
            }
            if (mce.Value != double.MinValue)
            {
                return(mce.Value);
            }

            // Calculate this value; usually a fairly expensive operation
            //   due to the common use of aggregate values.  We need to
            //   go thru the data more than once if we have to auto scale.
            Row lrow;

            this._ChartDefn.ChartMatrix.SetMyData(rpt, mce.Data);                       // Must set this for evaluation
            if (mce.Data.Data.Count > 0)
            {
                lrow = mce.Data.Data[0];
            }
            else
            {
                lrow = null;
            }
            ChartExpression ce = (ChartExpression)(mce.DisplayItem);

            double v = ce.Value.EvaluateDouble(rpt, lrow);

            mce.Value = v;                                              // cache so we don't need to calculate again
            return(v);
        }
Пример #2
0
        protected object GetCategoryValue(Report rpt, int row, out TypeCode tc)
        {
            MatrixCellEntry mce = _DataDefn[row, 0];

            if (mce == null)
            {
                tc = TypeCode.String;
                return("");                                                     // Not sure what this really means TODO:
            }

            Row lrow;

            this._ChartDefn.ChartMatrix.SetMyData(rpt, mce.Data);                       // Must set this for evaluation
            if (mce.Data.Data.Count > 0)
            {
                lrow = mce.Data.Data[0];
            }
            else
            {
                lrow = null;
            }
            ChartExpression ce = (ChartExpression)(mce.DisplayItem);

            object v = ce.Value.Evaluate(rpt, lrow);

            tc = ce.Value.GetTypeCode();
            return(v);
        }
Пример #3
0
        protected string GetSeriesValue(Report rpt, int iCol)
        {
            MatrixCellEntry mce = _DataDefn[0, iCol];
            Row             lrow;

            if (mce.Data.Data.Count > 0)
            {
                lrow = mce.Data.Data[0];
            }
            else
            {
                lrow = null;
            }
            ChartExpression ce = (ChartExpression)(mce.DisplayItem);

            string v = ce.Value.EvaluateString(rpt, lrow);

            return(v);
        }
Пример #4
0
        List<ReportItem> _Items; // list of report items

        #endregion Fields

        #region Constructors

        internal ReportItems(ReportDefn r, ReportLink p, XmlNode xNode)
            : base(r, p)
        {
            ReportItem ri;
            _Items = new List<ReportItem>();

            // Loop thru all the child nodes
            foreach(XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                    continue;
                switch (xNodeLoop.Name)
                {
                    case "Rectangle":
                        ri = new Rectangle(r, this, xNodeLoop);
                        break;
                    case "Line":
                        ri = new Line(r, this, xNodeLoop);
                        break;
                    case "Textbox":
                        ri = new Textbox(r, this, xNodeLoop);
                        break;
                    case "Image":
                        ri = new Image(r, this, xNodeLoop);
                        break;
                    case "Subreport":
                        ri = new Subreport(r, this, xNodeLoop);
                        break;
                    // DataRegions: list, table, matrix, chart
                    case "List":
                        ri = new List(r, this, xNodeLoop);
                        break;
                    case "Table":
                    case "Grid":
                    case "fyi:Grid":
                        ri = new Table(r, this, xNodeLoop);
                        break;
                    case "Matrix":
                        ri = new Matrix(r, this, xNodeLoop);
                        break;
                    case "Chart":
                        ri = new Chart(r, this, xNodeLoop);
                        break;
                    case "ChartExpression":		// For internal use only
                        ri = new ChartExpression(r, this, xNodeLoop);
                        break;
                    case "CustomReportItem":
                        ri = new CustomReportItem(r, this, xNodeLoop);
                        break;
                    default:
                        ri=null;		// don't know what this is
                        // don't know this element - log it
                        OwnerReport.rl.LogError(4, "Unknown ReportItems element '" + xNodeLoop.Name + "' ignored.");
                        break;
                }
                if (ri != null)
                {
                    _Items.Add(ri);
                }
            }
            if (_Items.Count == 0)
                OwnerReport.rl.LogError(8, "At least one item must be in the ReportItems.");
            else
                _Items.TrimExcess();
        }
Пример #5
0
        List <ReportItem> _Items;                                       // list of report items

        internal ReportItems(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p)
        {
            ReportItem ri;

            _Items = new List <ReportItem>();

            // Loop thru all the child nodes
            foreach (XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                {
                    continue;
                }
                switch (xNodeLoop.Name)
                {
                case "Rectangle":
                    ri = new Rectangle(r, this, xNodeLoop);
                    break;

                case "Line":
                    ri = new Line(r, this, xNodeLoop);
                    break;

                case "Textbox":
                    ri = new Textbox(r, this, xNodeLoop);
                    break;

                case "Image":
                    ri = new Image(r, this, xNodeLoop);
                    break;

                case "Subreport":
                    ri = new Subreport(r, this, xNodeLoop);
                    break;

                // DataRegions: list, table, matrix, chart
                case "List":
                    ri = new List(r, this, xNodeLoop);
                    break;

                case "Table":
                    ri = new Table(r, this, xNodeLoop);
                    break;

                case "Matrix":
                    ri = new Matrix(r, this, xNodeLoop);
                    break;

                case "Chart":
                    ri = new Chart(r, this, xNodeLoop);
                    break;

                case "ChartExpression":                                 // For internal use only
                    ri = new ChartExpression(r, this, xNodeLoop);
                    break;

                case "CustomReportItem":
                    ri = new CustomReportItem(r, this, xNodeLoop);
                    break;

                default:
                    ri = null;                                          // don't know what this is
                    // don't know this element - log it
                    OwnerReport.rl.LogError(4, "Unknown ReportItems element '" + xNodeLoop.Name + "' ignored.");
                    break;
                }
                if (ri != null)
                {
                    _Items.Add(ri);
                }
            }
            if (_Items.Count == 0)
            {
                OwnerReport.rl.LogError(8, "At least one item must be in the ReportItems.");
            }
            else
            {
                _Items.TrimExcess();
            }
        }
Пример #6
0
        void DrawDataPoint(Report rpt, Graphics g, Point p, System.Drawing.Rectangle rect, int row, int col)
        {
            MatrixCellEntry mce = _DataDefn[row, col];

            if (mce == null)
            {
                return;                                                 // Not sure what this really means TODO:
            }
            ChartExpression ce = (ChartExpression)(mce.DisplayItem);
            DataPoint       dp = ce.DP;

            if (dp.DataLabel == null || !dp.DataLabel.Visible)
            {
                return;
            }

            // Calculate the DataPoint value; usually a fairly expensive operation
            //   due to the common use of aggregate values.
            Row lrow;

            this._ChartDefn.ChartMatrix.SetMyData(rpt, mce.Data);                       // Must set this for evaluation
            if (mce.Data.Data.Count > 0)
            {
                lrow = mce.Data.Data[0];
            }
            else
            {
                lrow = null;
            }

            object   v = null;
            TypeCode tc;

            if (dp.DataLabel.Value == null)
            {                           // No DataLabel value specified so we use the actual value
                v  = ce.Value.EvaluateDouble(rpt, lrow);
                tc = TypeCode.Double;
            }
            else
            {                           // Evaluate the DataLable value for the display
                v  = dp.DataLabel.Value.Evaluate(rpt, lrow);
                tc = dp.DataLabel.Value.GetTypeCode();
            }

            if (dp.DataLabel.Style == null)
            {
                if (rect == System.Drawing.Rectangle.Empty)
                {
                    Size size = Style.MeasureStringDefaults(rpt, g, v, tc, lrow, int.MaxValue);
                    rect = new System.Drawing.Rectangle(p, size);
                }
                Style.DrawStringDefaults(g, v, rect);
            }
            else
            {
                if (rect == System.Drawing.Rectangle.Empty)
                {
                    Size size = dp.DataLabel.Style.MeasureString(rpt, g, v, tc, lrow, int.MaxValue);
                    rect = new System.Drawing.Rectangle(p, size);
                }
                dp.DataLabel.Style.DrawString(rpt, g, v, tc, lrow, rect);
            }

            return;
        }