public void OpenChartWizard(Chart chart)
        {
            ChartService _chartservice = null;
            string       id            = null;

            if (chart.Report.Type == ReportType.IndicatorReport)
            {
                id = "IndicatorChart";
                Hashtable       ctn = new Hashtable();
                SimpleHashtable sht = new SimpleHashtable();
                if (!string.IsNullOrEmpty(chart.DataSource))
                {
                    Section          indicatordetail = chart.Report.Sections[SectionType.IndicatorDetail];
                    IIndicatorMetrix metrix          = indicatordetail.Cells[chart.DataSource] as IIndicatorMetrix;
                    if (metrix == null)
                    {
                        throw new Exception("非法图表数据源矩阵");
                    }

                    sht.Add("__bcross__", metrix.CrossPart != null);
                    if (metrix.IndicatorParts != null)
                    {
                        foreach (IPart indi in metrix.IndicatorParts)
                        {
                            sht.Add((indi as Cell).Caption, (indi as Cell).Name);
                        }
                    }
                }
                else
                {
                    sht.Add("__bcross__", false);
                }
                ctn.Add(chart.Level, sht);
                _chartservice = new IndicatorChartService(chart.Report, ctn);
            }
            else
            {
                _chartservice = new ChartService(chart.Report);
            }

            ChartWizardAdapter _wizardadapter = new ChartWizardAdapter(_chartservice);

            if (_wizardadapter.ChartWizard.ShowDialog(_chartservice.GetSchemasAllLevel(chart.Level), chart.Level, id) == DialogResult.OK)
            {
                RemoteDataHelper rdh = DefaultConfigs.GetRemoteHelper();
                rdh.SaveChartStrings(ClientReportContext.Login.UfMetaCnnString, chart.Report.ViewID, chart.Report.ChartStrings);
            }
            else
            {
                chart.Report.ChartStrings = null;
            }
            chart.ChartWizard = null;
        }
Beispiel #2
0
        private void InitMyChart()
        {
            this.GetReport();
            ChartService cs = null;

            if (this.Report.Type == ReportType.IndicatorReport)
            {
                cs = new IndicatorChartService(this.Report, _captiontoname);
            }
            else
            {
                cs = new ChartService(this.Report);
            }
            if (bNullChart)
            {
                NewChart();
            }
            cs.InitializeChart(Level, null, _mychart);
            _mychart.Data.DataSource = DemoDataSourceForChartType(_mychart.ChartType);
            _mychart.Data.DataBind();
        }
Beispiel #3
0
        private void DrawCell(Cell c, int width, int height, int y, Graphics g)
        {
            if (!c.Visible)
            {
                return;
            }
            if (c is Expression)
            {
                string formula = (c as Expression).Formula.FormulaExpression.ToLower();
                if (formula == "page()")
                {
                    int pageindex = _pageindex + 1;//* _pagesinpage + _pageoffsize;
                    formula   = formula.Replace("page()", pageindex.ToString());
                    c.Caption = formula;
                }
                else if (formula == "pages()")
                {
                    int pages = _pages * _pagesinpage;
                    formula   = formula.Replace("pages()", pages.ToString());
                    c.Caption = formula;
                }
                else if (formula == "grouppage()")
                {
                    c.Caption = (_printpage == null? "" : Convert.ToString((_printpage.GroupPageIndex - 1) * _pagesinpage + _pageoffsize));
                }
                else if (formula == "grouppages()")
                {
                    c.Caption = (_printpage == null? "" : Convert.ToString(_printpage.GroupPages * _pagesinpage));
                }
                else if (c.GetStateType() == "PrintExpression")
                {
                    object o = (_printpage == null ? "": _printpage.GetValue(c));
                    if (o != null)
                    {
                        c.Caption = o.ToString();
                    }
                    else
                    {
                        c.Caption = "";
                    }
                }
            }
            else if (c is Chart)
            {
                #region chart
                Chart chart = c as Chart;
                if (chart.bNullChart)
                {
                    try
                    {
                        Infragistics.Win.UltraWinChart.UltraChart mychart = new Infragistics.Win.UltraWinChart.UltraChart();
                        chart.MyChart = mychart;
                        ChartService cs = null;
                        if (_report.Type == ReportType.IndicatorReport)
                        {
                            cs = new IndicatorChartService(_report, chart.CaptionToName);
                        }
                        else
                        {
                            cs = new ChartService(_report);
                        }
                        cs.InitializeChart(chart.Level, null, mychart);
                        if (chart.Data == null)
                        {
                            RuntimeGroup group = null;
                            if (chart.Level > 1)
                            {
                                group = AddARuntimeGroup(_report);
                                GroupHeaderRow pr = (this as GroupRow).ParentRow;
                                while (pr != null)
                                {
                                    group.AddAUpperGroup(pr.AddARuntimeGroup(_report));
                                    pr = pr.ParentRow;
                                }
                            }
                            mychart.Data.DataSource = cs.GetDataSource(chart.Level, null, group, mychart.ChartType);
                        }
                        else
                        {
                            mychart.Data.DataSource = cs.GetDataSource(chart.Level, null, chart.Data, mychart.ChartType);
                        }

                        mychart.Data.DataBind();
                    }
                    catch (Exception e)
                    {
                        chart.Caption         = e.Message;
                        chart.bExceptionChart = true;
                    }
                }
                #endregion
            }
            int x = ConvertFromInternalToControl(c.X);
            if (width != -1 && (x >= width || x + c.Width <= 0))
            {
                return;
            }

            int h;
            int ycor = y;
            if (c is SuperLabel)
            {
                if (_bautoheight)
                {
                    h = c.RuntimeHeight;
                }
                else
                {
                    h = c.Height;
                }
            }
            else
            {
                if (_bautoheight)
                {
                    h = c.ExpandHeight;
                }
                else
                {
                    h = c.MetaHeight;
                }
            }

            int celly = c.Y;
            if (c is Label && _bautoheight)
            {
                if (celly < (c as Label).AutoHeightY)
                {
                    celly = (c as Label).AutoHeightY;
                }
            }

            //if(! (c is SubReport))
            //{
            if (c.KeepPos)
            {
                ycor += celly - _ybase;
            }
            else
            {
                h = this.Height;
            }
            //}
            c.bActive      = false;
            c.bInActiveRow = false;
            if (bActiveCell != null && bActiveCell(c))
            {
                c.bActive = true;
            }
            if (bActiveRow != null && bActiveRow(this) && hasActiveCell != null && hasActiveCell())//!hasActiveCell()
            {
                c.bInActiveRow = true;
            }


            DrawIt(c, g, x, ycor, width, height, h);
        }