Ejemplo n.º 1
0
        private string GetTypeDesignator(ReportDefPresentations overriding_type)
        {
            var type = GraphType;

            if (overriding_type != ReportDefPresentations.None)
            {
                type = overriding_type;
            }
            switch (type)
            {
            case ReportDefPresentations.Linechart:
                return("line");

            case ReportDefPresentations.Barchart:
                return("column");

            default:
                throw new NotSupportedException(String.Format("{0} cannot render the \"{1}\" geometry.", this.GetType().Name, GraphType.ToString()));
            }
        }
Ejemplo n.º 2
0
        private Chart RenderChart(ReportDefPresentations charttype)
        {
            var chart = new Chart(m)
            {
                GraphType = charttype
            };
            /* generate series */
            //var matrix = AsCrosstab;
            //if (matrix.ColumnHeadersDiscrete == null)
            //{
            //    /* single-series version: each X col header is a graph:
            //     * a. one series per data row */
            //    int seriesordinal = 0;
            //    foreach (var seriesitem in matrix.Rows)
            //        chart.Series.Add(new ChartSeries() { Ordinal = ++seriesordinal, Seriesname = seriesitem.CompositeLabel });
            //    /* b. one graph per column */
            //    int graphordinal = 0;
            //    foreach (var label in matrix.ColumnHeadersTopMerged)
            //    {
            //        var graph = new ChartGraph()
            //        {
            //            GraphType = charttype,
            //            Ordinal = graphordinal + 1,
            //            Title = label.ColumnDisplayname,
            //            Color = GraphColor(graphordinal + 1)
            //        };
            //        chart.Graphs.Add(graph);
            //        /* assign the values from the matrix */
            //        seriesordinal = 0;
            //        foreach (var row in matrix.Rows)
            //        {
            //            var val = row.Values[graphordinal];
            //            graph.Values.Add(++seriesordinal, new ChartValue()
            //            {
            //                SeriesOrdinal = seriesordinal,
            //                iValue = val.iValue,
            //                cValue = val.cValue,
            //                sValue = row.Values[graphordinal].sValue
            //            });
            //        }
            //        /* next graph */
            //        ++graphordinal;
            //    }
            //    /* add a pareto graph? */
            //    if (PresentationOptions.HasFlag(ReportPresentationOptions.Pareto))
            //    {
            //        Debug.Assert(PresentationOptions.HasFlag(ReportPresentationOptions.AsPercentages));
            //        var graph = new ChartGraph()
            //        {
            //            GraphType = ReportDefPresentations.Linechart,
            //            Ordinal = ++graphordinal,
            //            Title = OnBuiltinReportLiteral(2862), /* Pareto line */
            //            Color = Color.Maroon
            //        };
            //        /* the data for the pareto line is in a separate data table */
            //        var pareto = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_INCRCA_PARETOLINE];
            //        seriesordinal = 0;
            //        foreach (DataRow row in pareto.Rows)
            //        {
            //            var val = Convert.ToInt32(row["Y"]);
            //            graph.Values.Add(++seriesordinal, new ChartValue()
            //            {
            //                SeriesOrdinal = seriesordinal,
            //                iValue = val,
            //                sValue = val.ToString()
            //            });
            //        }
            //        if (seriesordinal > 0)
            //            chart.Graphs.Add(graph);
            //    }
            //}
            //else
            //{
            //    /* multi-series variation */



            //}
            /* chart general props - the same for single- as well as for multi-series */
            string sTitle;

            if (chart.Graphs.Count == 1)
            {
                sTitle = chart.Graphs[0].Title;
            }
            else
            {
                sTitle = String.Format(OnBuiltinReportLiteral(2846), chart.Graphs.Count.ToString()); /* {0} incident key performance indicators */
            }
            chart.Title    = String.Format(OnBuiltinReportLiteral(2845), sTitle);                    /* Chart 1. {0} */
            chart.Stacked  = PresentationOptions.HasFlag(ReportPresentationOptions.BarsStacked);
            chart.Animated = base.Animated;
            /* deliver */
            return(chart);
        }