Ejemplo n.º 1
0
        public void SetupChartSeriesTitle(SeriesTitle title)
        {
            title.Alignment          = Alignment;
            title.EnableAntialiasing = DefaultBoolean.True;
            title.Text       = Text;
            title.Visibility = DefaultBoolean.True;
            title.WordWrap   = WordWrap;

            if (Dock.HasValue)
            {
                title.Dock = Dock.Value;
            }
            if (Indent.HasValue)
            {
                title.Indent = Indent.Value;
            }

            var font = Utils.StringToFont(Font, out Color fontColor);

            if (font != null)
            {
                title.Font = font;
            }
            if (fontColor != Color.Empty)
            {
                title.TextColor = fontColor;
            }
        }
Ejemplo n.º 2
0
        //Version 1.1 Considers series title of parent reference, if applicable
        public bool IsTemplateForReference(ConditionalTemplate template, Citation citation)
        {
            if (citation == null)
            {
                return(false);
            }
            if (citation.Reference == null)
            {
                return(false);
            }

            SeriesTitle seriesTitle = null;

            if (citation.Reference.HasCoreField(ReferenceTypeCoreFieldId.SeriesTitle))
            {
                seriesTitle = citation.Reference.SeriesTitle;
            }
            else
            {
                if (citation.Reference.ParentReference != null && citation.Reference.ParentReference.HasCoreField(ReferenceTypeCoreFieldId.SeriesTitle))
                {
                    seriesTitle = citation.Reference.ParentReference.SeriesTitle;
                }
            }

            if (seriesTitle == null)
            {
                return(false);
            }

            return(string.Equals(seriesTitle.Name, "NAME", StringComparison.OrdinalIgnoreCase));
            //return seriesTitle.Name.StartsWith("NAME", StringComparison.OrdinalIgnoreCase);
            //return seriesTitle.Name.EndsWith("NAME", StringComparison.OrdinalIgnoreCase);
        }
Ejemplo n.º 3
0
        public SCChart AddSeriesTitle(string seriesName, string text, SeriesTitleOptions options = null)
        {
            options ??= new SeriesTitleOptions();

            DevExpress.XtraCharts.Series series;
            if (string.IsNullOrWhiteSpace(seriesName))
            {
                series = CurrentSeries;
            }
            else
            {
                series = Chart.Series[seriesName];
            }
            if (series == null)
            {
                throw new Exception($"Cannot find series '{seriesName}'.");
            }

            if (series.View is not SimpleDiagramSeriesViewBase seriesView)
            {
                throw new Exception("Series title is supported only on 2D Pie, Doughnut and Funnel series.");
            }

            var seriesTitle = new SeriesTitle();

            options.SetupChartSeriesTitle(this, text, seriesTitle);
            seriesView.Titles.Add(seriesTitle);

            return(this);
        }
Ejemplo n.º 4
0
        protected override void UpdateChart()
        {
            Series series;

            if (string.IsNullOrWhiteSpace(SeriesName))
            {
                series = ChartContext.CurrentSeries;
            }
            else
            {
                series = ChartContext.Chart.Series[SeriesName];
            }
            if (series == null)
            {
                throw new Exception($"Cannot find series '{SeriesName}'.");
            }

            if (ChartContext.CurrentSeries.View is not SimpleDiagramSeriesViewBase seriesView)
            {
                throw new Exception("Series title is supported only on 2D Pie, Doughnut and Funnel series.");
            }

            var seriesTitle = new SeriesTitle();

            SetupChartSeriesTitle(seriesTitle);
            seriesView.Titles.Add(seriesTitle);
        }
Ejemplo n.º 5
0
        private void InitPieChart(List <ProjectSummary> dataSource, string valueName, ChartControl pieChart)
        {
            // pie chart
            Series pieSeries = new Series();

            pieSeries.ValueScaleType = ScaleType.Numerical;
            pieSeries.LegendPointOptions.PointView = PointView.Argument;
            pieSeries.LegendPointOptions.ValueNumericOptions.Format = NumericFormat.Percent;
            PieSeriesView pieView = new PieSeriesView();

            pieView.ExplodedDistancePercentage = 10;
            SeriesTitle title = new SeriesTitle();

            title.Text = Properties.Resources.ResourceManager.GetString(valueName + "Rate");
            pieView.Titles.Add(title);
            pieView.RuntimeExploding = true;
            pieSeries.View           = pieView;

            foreach (var item in dataSource)
            {
                SeriesPoint seriesPoint = new SeriesPoint(item.Name, new object[] { ((object)(item.GetType().GetProperty(valueName).GetValue(item, null))) });
                pieSeries.Points.Add(seriesPoint);
            }
            pieChart.Series.Add(pieSeries);


            PieSeriesLabel pieSerieslable = pieSeries.Label as PieSeriesLabel;

            if (pieSerieslable != null)
            {
                pieSerieslable.PointOptions.PointView = PointView.ArgumentAndValues;
                pieSerieslable.Position      = PieSeriesLabelPosition.TwoColumns;
                pieSerieslable.TextAlignment = StringAlignment.Center;
            }
            PiePointOptions options = pieSeries.Label.PointOptions as PiePointOptions;

            if (options != null)
            {
                options.PercentOptions.PercentageAccuracy = 2;
                options.PercentOptions.ValueAsPercent     = true;
                options.ValueNumericOptions.Format        = NumericFormat.Percent;
            }
        }
        public void LoadGraph()
        {
            int t1 = System.Environment.TickCount;

            if (_report.State != Report.StateEnum.Executed)
                return;

            _chCtrl.BeginInit();

            bool rotateGraph = false;
            bool pivotAxes = ((_report.GraphOptions & OlapReport.GraphOptionsEnum.Pivot) > 0);

            int seriesPosCount = (pivotAxes ? _report.Cellset.Axis1PosCount : _report.Cellset.Axis0PosCount);
            int seriesMemCount = (pivotAxes ? _report.Cellset.Axis1TupleMemCount : _report.Cellset.Axis0TupleMemCount);
            int catPosCount = (pivotAxes ? _report.Cellset.Axis0PosCount : _report.Cellset.Axis1PosCount);
            int catMemCount = (pivotAxes ? _report.Cellset.Axis0TupleMemCount : _report.Cellset.Axis1TupleMemCount);
            if (seriesPosCount == 0 || catPosCount == 0)
                return;

            Size size = new Size(_report.GraphWidth, _report.GraphHeight);
            size = this.AdjustGraphWidth(size, _report.GraphType);

            // limit number of series
            if (seriesPosCount > __MaxSeriesCount)
                seriesPosCount = __MaxSeriesCount;
            if (_report.GraphType == OlapReport.GraphTypeEnum.Pie || _report.GraphType == OlapReport.GraphTypeEnum.PieBrokenApart)
                if (seriesPosCount > __MaxPieCount)
                    seriesPosCount = __MaxPieCount;

            // limit number of categories
            if (catPosCount > __MaxCategoriesCount)
                catPosCount = __MaxCategoriesCount;

            bool showValues = (_report.GraphOptions & OlapReport.GraphOptionsEnum.ShowValues) > 0;
            bool showSeries = (_report.GraphOptions & OlapReport.GraphOptionsEnum.ShowSeries) > 0;
            bool showCats = (_report.GraphOptions & OlapReport.GraphOptionsEnum.ShowCategories) > 0;
            bool setScaling = _report.GraphType != OlapReport.GraphTypeEnum.Pie && ((_report.GraphOptions & OlapReport.GraphOptionsEnum.ScalingBySeries) > 0);
            bool setPerc = !setScaling && ((_report.GraphOptions & OlapReport.GraphOptionsEnum.PercentByCategories) > 0);
            byte graphPieColumns = (_report.GraphPieColumns == 0 ?
                Convert.ToByte(Math.Sqrt(seriesPosCount)) : _report.GraphPieColumns);
            byte graphMixedLinePos = _report.GraphMixedLinePosition;
            graphMixedLinePos = (graphMixedLinePos <= 0 || graphMixedLinePos > seriesPosCount ? (byte)1 : graphMixedLinePos);

            // theme
            if (_report.GraphTheme != null && _report.GraphTheme != "")
                _chCtrl.AppearanceName = _report.GraphTheme;

            // create series
            for (int i = 0; i < seriesPosCount; i++)
            {
                string name = "";
                for (int j = 0; j < seriesMemCount; j++)
                    name += (j == 0 ? "" : " | ") + (pivotAxes ? _report.Cellset.GetCellsetMember(1, j, i).Name : _report.Cellset.GetCellsetMember(0, j, i).Name);

                Series series = new Series();
                series.Name = name;

                // type
                if (_report.GraphType == OlapReport.GraphTypeEnum.Pie || _report.GraphType == OlapReport.GraphTypeEnum.PieBrokenApart)
                {
                    // if pie, each of series is displayed as individual graph
                    if (_report.GraphType == OlapReport.GraphTypeEnum.PieBrokenApart)
                        _chCtrl.Series.Clear();
                    _chCtrl.Series.Add(series);

                    series.ChangeView(ViewType.Pie);

                    PiePointOptions ppo = (PiePointOptions)series.PointOptions;
                    PieSeriesView psw = (PieSeriesView)series.View;
                    PieSeriesLabel psl = (PieSeriesLabel)series.Label;

                    psl.Position = PieSeriesLabelPosition.TwoColumns;
                    series.PointOptions.PointView = PointView.Undefined;

                    if (_report.GraphType == OlapReport.GraphTypeEnum.Pie)
                    {
                        SimpleDiagram sd = new SimpleDiagram();
                        sd.LayoutDirection = LayoutDirection.Horizontal;
                        sd.Dimension = graphPieColumns;
                        _chCtrl.Diagram = sd;
                    }

                    // legend
                    if (showCats)
                        _chCtrl.Legend.Visible = false;

                    series.Label.OverlappingOptions.ResolveOverlapping = true;
                    series.LegendPointOptions.PointView = PointView.Argument;

                    _chCtrl.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Center;
                    _chCtrl.Legend.AlignmentVertical = LegendAlignmentVertical.BottomOutside;
                    _chCtrl.Legend.Direction = LegendDirection.LeftToRight;

                    // series title
                    SeriesTitle sTitle = new SeriesTitle();
                    sTitle.Text = name;
                    sTitle.Alignment = StringAlignment.Center;
                    sTitle.Dock = ChartTitleDockStyle.Bottom;
                    psw.Titles.Add(sTitle);
                }
                else
                {
                    // diagram
                    if (_chCtrl.Diagram == null)
                        _chCtrl.Diagram = new XYDiagram();
                    XYDiagram diag = (XYDiagram)_chCtrl.Diagram;

                    //// panes
                    //if (_report.GraphType == OlapReport.GraphTypeEnum.LineWithBars && graphMixedLinePos <= seriesPosCount && diag.Panes.Count == 0)
                    //{
                    //    // add new pane
                    //    XYDiagramPane pane = new XYDiagramPane();
                    //    pane.Visible = true;
                    //    pane.SizeMode = PaneSizeMode.UseWeight;
                    //    pane.Weight = 0.66;
                    //    diag.PaneLayoutDirection = PaneLayoutDirection.Vertical;
                    //    diag.Panes.Add(pane);

                    //    // set default pane weight
                    //    diag.DefaultPane.SizeMode = PaneSizeMode.UseWeight;
                    //    diag.DefaultPane.Weight = 0.33;
                    //}

                    // add series
                    _chCtrl.Series.Add(series);

                    // add series to secondary pane if needed (in case of LineWithBars)
                    if (diag.Panes.Count > 0 && i != graphMixedLinePos - 1)
                        ((XYDiagramSeriesViewBase)series.View).Pane = diag.Panes[0];

                    if (_report.GraphType == OlapReport.GraphTypeEnum.BarVertical)
                    {
                        series.ChangeView(ViewType.Bar);
                    }
                    else if (_report.GraphType == OlapReport.GraphTypeEnum.BarHorizontal)
                    {
                        series.ChangeView(ViewType.Bar);
                        rotateGraph = true;
                    }
                    else if (_report.GraphType == OlapReport.GraphTypeEnum.StackedBarVertical)
                        series.ChangeView(ViewType.StackedBar);
                    else if (_report.GraphType == OlapReport.GraphTypeEnum.StackedBarHorizontal)
                    {
                        series.ChangeView(ViewType.StackedBar);
                        rotateGraph = true;
                    }
                    else if (_report.GraphType == OlapReport.GraphTypeEnum.LineHorizontal)
                        series.ChangeView(ViewType.Line);
                    else if (_report.GraphType == OlapReport.GraphTypeEnum.LineWithBars)
                    {
                        if (i == graphMixedLinePos - 1)
                        {
                            //if (!setScaling)
                            //{
                            //    // create secondary axis
                            //    SecondaryAxisY axisY = new SecondaryAxisY(series.Name);
                            //    axisY.Visible = true;
                            //    axisY.Title.Text = series.Name;
                            //    axisY.Title.Visible = true;
                            //    axisY.Alignment = AxisAlignment.Near;
                            //    ((XYDiagram)_chCtrl.Diagram).SecondaryAxesY.Add(axisY);
                            //    ((XYDiagramSeriesViewBase)series.View).AxisY = axisY;

                            //    // set default axis title
                            //    ((XYDiagram)_chCtrl.Diagram).AxisY.Title.Text = "Bar axis";
                            //    ((XYDiagram)_chCtrl.Diagram).AxisY.Title.Visible = true;
                            //}

                            // change view
                            series.ChangeView(ViewType.Line);
                        }
                        else
                            series.ChangeView(ViewType.Bar);
                    }

                    // 20 pixels per label (250 pixels for legend), othervise overlapping resolution will never finish
                    if ((size.Width - 250) / catPosCount > 20)
                    {
                        series.Label.OverlappingOptions.ResolveOverlapping = true;
                        PointOverlappingOptions poo = series.Label.OverlappingOptions as PointOverlappingOptions;
                        if (poo != null)
                            poo.AttractToMarker = true;
                    }

                    series.LegendText = name;
                    series.ShowInLegend = true;
                    series.ValueScaleType = ScaleType.Numerical;
                    series.PointOptions.PointView = PointView.Undefined;
                    series.LegendPointOptions.PointView = PointView.SeriesName;
                    series.Visible = true;

                    // labels orientation
                    diag.Rotated = rotateGraph;
                    if (rotateGraph)
                    {
                        diag.AxisY.Label.Antialiasing = true;
                        diag.AxisY.Label.Angle = 315;
                    }
                    else
                    {
                        diag.AxisX.Label.Antialiasing = true;
                        diag.AxisX.Label.Angle = 315;
                    }

                    // if scaling
                    if (setScaling)
                        diag.AxisY.Visible = false;
                }

                // prepare scaling ranges
                double scalingMin = double.MaxValue;
                double scalingMax = double.MinValue;
                if (setScaling)
                {
                    for (int l = 0; l < catPosCount; l++)
                    {
                        string val = (pivotAxes ? _report.Cellset.GetCell(l, i).Value : _report.Cellset.GetCell(i, l).Value);
                        double dVal = 0;
                        double.TryParse(val, System.Globalization.NumberStyles.Float, System.Globalization.NumberFormatInfo.InvariantInfo, out dVal);
                        if (dVal < scalingMin)
                            scalingMin = dVal;
                        if (dVal > scalingMax)
                            scalingMax = dVal;
                    }
                }
                scalingMin = scalingMin - (scalingMax - scalingMin) * 0.1;

                // set data
                double percSum = 0;
                for (int l = 0; l < catPosCount; l++)
                {
                    string argument = "";
                    for (int m = 0; m < catMemCount; m++)
                        argument += (m == 0 ? "" : " | ") + (pivotAxes ? _report.Cellset.GetCellsetMember(0, m, l).Name : _report.Cellset.GetCellsetMember(1, m, l).Name);

                    string val = (pivotAxes ? _report.Cellset.GetCell(l, i).Value : _report.Cellset.GetCell(i, l).Value);

                    double dVal = 0;
                    double.TryParse(val, System.Globalization.NumberStyles.Float, System.Globalization.NumberFormatInfo.InvariantInfo, out dVal);
                    if (setPerc)
                        percSum += dVal;
                    else if (setScaling)
                        dVal = (scalingMax - scalingMin == 0 ? 0 : (dVal - scalingMin) / (scalingMax - scalingMin));

                    string fVal = (pivotAxes ? _report.Cellset.GetCell(l, i).FormattedValue : _report.Cellset.GetCell(i, l).FormattedValue);

                    SeriesPoint sp = new SeriesPoint(argument, new double[] { dVal });
                    sp.Tag = fVal;
                    series.Points.Add(sp);
                }

                // set custom labels and value as percentage
                for (int l = 0; l < catPosCount; l++)
                {
                    SeriesPoint sp = series.Points[l];
                    if (setPerc)
                    {
                        sp.Values[0] = sp.Values[0] / percSum;
                        sp.Tag = sp.Values[0].ToString("P");
                    }

                    // custom point label
                    string customLabel = string.Empty;
                    if (!showValues && !showSeries && !showCats)
                        series.Label.Visible = false;
                    else
                    {
                        string fVal = (string)sp.Tag;
                        if (fVal == null || fVal == "")
                            fVal = "0";
                        customLabel = (showSeries ? series.Name : string.Empty);
                        customLabel += (showCats ? (customLabel != string.Empty ? " | " : string.Empty) + sp.Argument : string.Empty);
                        customLabel += (showValues ? (customLabel != string.Empty ? ": " : string.Empty) + fVal : string.Empty);
                    }

                    series.Points[l].Tag = customLabel;
                }

                // for pie, layout each of series individually
                if (_report.GraphType == OlapReport.GraphTypeEnum.PieBrokenApart)
                {
                    _chCtrl.Titles.Clear();
                    _chCtrl.EndInit();
                    LayoutGraph(_report.ID.ToString() + "." + i.ToString(), size, graphPieColumns);

                    // init next chart
                    if (i < seriesPosCount - 1)
                    {
                        _chCtrl = new DevExpress.XtraCharts.Web.WebChartControl();
                        _chCtrl.BeginInit();
                    }
                }
            }

            int t2 = System.Environment.TickCount;

            if (_report.GraphType != OlapReport.GraphTypeEnum.PieBrokenApart)
            {
                ChartTitle title = new ChartTitle();
                title.Alignment = StringAlignment.Center;
                title.Lines = new string[] { _report.Name, _report.Description };
                _chCtrl.Titles.Add(title);

                LayoutGraph(_report.ID.ToString(), size, 0);
            }

            // if LineWithBars
            if (_report.GraphType == OlapReport.GraphTypeEnum.LineWithBars)
            {
                // fill combo
                for (int i = 0; i < _chCtrl.Series.Count; i++)
                    this.selMixedLinePos.Items.Add(new ListItem(_chCtrl.Series[i].Name, (i + 1).ToString()));
                this.selMixedLinePos.SelectedIndex = graphMixedLinePos - 1;

                // set line as last
                if (!(_chCtrl.Series[_chCtrl.Series.Count - 1].View is LineSeriesView))
                {
                    // roll down through series
                    for (int i = graphMixedLinePos - 1; i < _chCtrl.Series.Count - 1; i++)
                        _chCtrl.Series.Swap(i, i + 1);
                }
            }

            int t3 = System.Environment.TickCount;
            double time1 = (t3 - t2) / 1000.0;
            double time2 = (t2 - t1) / 1000.0;
            t1 = 0;
        }
        public IEnumerable <ITextUnit> GetTextUnits(ComponentPart componentPart, Template template, Citation citation, out bool handled)
        {
            handled = false;

            if (componentPart == null)
            {
                return(null);
            }

            Reference currentReference = citation.Reference;

            if (currentReference == null)
            {
                return(null);
            }

            Reference currentParentReference = currentReference.ParentReference;             // can be null;

            if (componentPart == null)
            {
                return(null);
            }
            if (componentPart.Elements == null || !componentPart.Elements.Any())
            {
                return(null);
            }

            Reference referenceInScope = null;

            if (componentPart.Scope == ComponentPartScope.ParentReference && currentParentReference != null)
            {
                referenceInScope = currentParentReference;
            }
            else if (componentPart.Scope == ComponentPartScope.Reference)
            {
                referenceInScope = currentReference;
            }

            SeriesTitle seriesTitle = referenceInScope.SeriesTitle;

            if (seriesTitle == null)
            {
                return(null);
            }

            SeriesTitleFieldElement seriesTitleFieldElement = componentPart.Elements.OfType <SeriesTitleFieldElement>().FirstOrDefault() as SeriesTitleFieldElement;

            if (seriesTitleFieldElement == null)
            {
                return(null);
            }

            bool found = false;
            TextUnitCollection textUnits = seriesTitleFieldElement.GetTextUnits(citation, template);

            if (textUnits == null)
            {
                return(null);
            }

            foreach (ITextUnit textUnit in textUnits)
            {
                if (textUnit.Text.Contains(" "))
                {
                    found         = true;
                    textUnit.Text = textUnit.Text.Replace(" ", "\u00A0");
                }
            }

            if (found)
            {
                componentPart.Elements.ReplaceItem(seriesTitleFieldElement, textUnits.TextUnitsToLiteralElements(componentPart));
            }

            return(null);
        }
Ejemplo n.º 8
0
        public bool IsTemplateForReference(ConditionalTemplate template, Citation citation)
        {
            //Other work in the same series was cited in a previous footnote
            if (citation == null)
            {
                return(false);
            }

            var currentFootnoteCitation = citation as FootnoteCitation;

            if (currentFootnoteCitation == null)
            {
                return(false);
            }

            Reference   currentReference = currentFootnoteCitation.Reference;
            SeriesTitle currentSeries    = currentReference.SeriesTitle;

            if (currentSeries == null && currentReference.ParentReference != null)
            {
                currentSeries = currentReference.ParentReference.SeriesTitle;
            }
            if (currentSeries == null)
            {
                return(false);
            }


            // regarding placeholderCitation.PersonOnly: see comment for RepeatingInTextCitation
            if (currentFootnoteCitation.RuleSetOverride != RuleSetOverride.None)
            {
                return(false);
            }
            if (currentFootnoteCitation.YearOnly)
            {
                return(false);
            }

            foreach (var otherFootnoteCitation in currentFootnoteCitation.CitationManager.FootnoteCitations)
            {
                if (otherFootnoteCitation == currentFootnoteCitation)
                {
                    break;                                                                   //we just look in the direction of the beginning of the document
                }
                Reference otherReference = otherFootnoteCitation.Reference;
                if (otherReference == null)
                {
                    continue;
                }

                SeriesTitle otherSeries = otherReference.SeriesTitle;
                if (otherSeries == null && otherReference.ParentReference != null)
                {
                    otherSeries = otherReference.ParentReference.SeriesTitle;
                }
                if (otherSeries == null)
                {
                    continue;
                }

                if (otherSeries == currentSeries && otherReference != currentReference)
                {
                    return(true);
                }
            }

            //still here? nothing found, return false
            return(false);
        }
Ejemplo n.º 9
0
        private void BindChart()
        {
            string dimensionName = string.Empty;

            if (dimsionValue > 0)
            {
                dimensionName = ((Dimension)dimsionValue).ToString();
            }
            xrChart1.Series.Clear();
            if (dimsionValue <= 0 && chartType == 0)
            {
                Series pieSeries = new Series();
                pieSeries.ValueScaleType = ScaleType.Numerical;
                pieSeries.LegendPointOptions.PointView = PointView.Argument;
                pieSeries.LegendPointOptions.ValueNumericOptions.Format = NumericFormat.Percent;
                PieSeriesView pieView = new PieSeriesView();
                pieView.ExplodedDistancePercentage = 10;
                SeriesTitle title = new SeriesTitle();
                title.Text = GetLocalizedCaption(targetName) + "-" + GetLocalizedCaption("Rate");
                pieView.Titles.Add(title);
                pieView.RuntimeExploding = true;
                pieSeries.View           = pieView;

                List <SaleOverview> dataList = (List <SaleOverview>) this.DataSource;
                var resultData = dataList.AsQueryable().GroupBy("UnitName", "it")
                                 .Select("new (Key as UnitName,Sum(" + targetName + ") as " + targetName + ")", null);

                foreach (var item in resultData)
                {
                    Type        itemType    = item.GetType();
                    SeriesPoint seriesPoint = new SeriesPoint(itemType.GetProperty("UnitName").GetValue(item, null)
                                                              , new object[] { ((object)itemType.GetProperty(targetName).GetValue(item, null)) });
                    pieSeries.Points.Add(seriesPoint);
                }
                xrChart1.Series.Add(pieSeries);

                PieSeriesLabel pieSerieslable = pieSeries.Label as PieSeriesLabel;
                if (pieSerieslable != null)
                {
                    pieSerieslable.PointOptions.PointView = PointView.ArgumentAndValues;
                    pieSerieslable.Position      = PieSeriesLabelPosition.TwoColumns;
                    pieSerieslable.TextAlignment = StringAlignment.Center;
                }
                PiePointOptions options = pieSeries.Label.PointOptions as PiePointOptions;
                if (options != null)
                {
                    options.PercentOptions.PercentageAccuracy = 2;
                    options.PercentOptions.ValueAsPercent     = true;
                    options.ValueNumericOptions.Format        = NumericFormat.Percent;
                }
            }
            else
            {
                List <SaleOverview> dataList     = (List <SaleOverview>) this.DataSource;
                List <string>       demisionList = new List <string>();

                if (!string.IsNullOrEmpty(dimensionName))
                {
                    foreach (var item in dataList)
                    {
                        Type   itemType     = item.GetType();
                        string demisionName = itemType.GetProperty(dimensionName).GetValue(item, null).ToString();
                        if (!demisionList.Contains(demisionName))
                        {
                            demisionList.Add(demisionName);
                        }
                    }
                }
                else
                {
                    demisionList.Add(string.Empty);
                }

                for (int d = 0; d < demisionList.Count; d++)
                {
                    IQueryable resultData = null;
                    if (!string.IsNullOrEmpty(dimensionName))
                    {
                        resultData = dataList.AsQueryable().Where(dimensionName + "=@0", demisionList[d]).GroupBy("UnitName", "it")
                                     .Select("new (Key as UnitName,Sum(" + targetName + ") as " + targetName + ")", null);
                    }
                    else
                    {
                        resultData = dataList.AsQueryable().GroupBy("UnitName", "it")
                                     .Select("new (Key as UnitName,Sum(" + targetName + ") as " + targetName + ")", null);
                    }

                    Series lineSeries = new Series();
                    lineSeries.Name         = demisionList[d];
                    lineSeries.ShowInLegend = true;
                    if (chartType == 1)
                    {
                        LineSeriesView lineView = new LineSeriesView();
                        lineSeries.View = lineView;
                    }
                    else if (chartType == 2)
                    {
                        BarSeriesView barView = new SideBySideBarSeriesView();
                        lineSeries.View = barView;
                    }

                    foreach (var item in resultData)
                    {
                        Type itemType = item.GetType();

                        SeriesPoint effortSeriesPoint = new SeriesPoint(itemType.GetProperty("UnitName").GetValue(item, null)
                                                                        , new object[] { ((object)(itemType.GetProperty(targetName).GetValue(item, null))) });
                        lineSeries.Points.Add(effortSeriesPoint);
                    }
                    xrChart1.Series.Add(lineSeries);
                }
                XYDiagram diagram = xrChart1.Diagram as XYDiagram;
                if (diagram == null)
                {
                    return;
                }
                diagram.AxisY.Title.Visible = true;
                if (!string.IsNullOrEmpty(dimensionName))
                {
                    diagram.AxisY.Title.Text = GetLocalizedCaption(dimensionName) + "-" + GetLocalizedCaption(targetName);
                }
                else
                {
                    diagram.AxisY.Title.Text = string.Empty;
                }
            }
        }
Ejemplo n.º 10
0
        public void LoadGraph()
        {
            int t1 = System.Environment.TickCount;

            if (_report.State != Report.StateEnum.Executed)
            {
                return;
            }

            _chCtrl.BeginInit();

            bool rotateGraph = false;
            bool pivotAxes   = ((_report.GraphOptions & OlapReport.GraphOptionsEnum.Pivot) > 0);

            int seriesPosCount = (pivotAxes ? _report.Cellset.Axis1PosCount : _report.Cellset.Axis0PosCount);
            int seriesMemCount = (pivotAxes ? _report.Cellset.Axis1TupleMemCount : _report.Cellset.Axis0TupleMemCount);
            int catPosCount    = (pivotAxes ? _report.Cellset.Axis0PosCount : _report.Cellset.Axis1PosCount);
            int catMemCount    = (pivotAxes ? _report.Cellset.Axis0TupleMemCount : _report.Cellset.Axis1TupleMemCount);

            if (seriesPosCount == 0 || catPosCount == 0)
            {
                return;
            }

            Size size = new Size(_report.GraphWidth, _report.GraphHeight);

            size = this.AdjustGraphWidth(size, _report.GraphType);

            // limit number of series
            if (seriesPosCount > __MaxSeriesCount)
            {
                seriesPosCount = __MaxSeriesCount;
            }
            if (_report.GraphType == OlapReport.GraphTypeEnum.Pie || _report.GraphType == OlapReport.GraphTypeEnum.PieBrokenApart)
            {
                if (seriesPosCount > __MaxPieCount)
                {
                    seriesPosCount = __MaxPieCount;
                }
            }

            // limit number of categories
            if (catPosCount > __MaxCategoriesCount)
            {
                catPosCount = __MaxCategoriesCount;
            }

            bool showValues      = (_report.GraphOptions & OlapReport.GraphOptionsEnum.ShowValues) > 0;
            bool showSeries      = (_report.GraphOptions & OlapReport.GraphOptionsEnum.ShowSeries) > 0;
            bool showCats        = (_report.GraphOptions & OlapReport.GraphOptionsEnum.ShowCategories) > 0;
            bool setScaling      = _report.GraphType != OlapReport.GraphTypeEnum.Pie && ((_report.GraphOptions & OlapReport.GraphOptionsEnum.ScalingBySeries) > 0);
            bool setPerc         = !setScaling && ((_report.GraphOptions & OlapReport.GraphOptionsEnum.PercentByCategories) > 0);
            byte graphPieColumns = (_report.GraphPieColumns == 0 ?
                                    Convert.ToByte(Math.Sqrt(seriesPosCount)) : _report.GraphPieColumns);
            byte graphMixedLinePos = _report.GraphMixedLinePosition;

            graphMixedLinePos = (graphMixedLinePos <= 0 || graphMixedLinePos > seriesPosCount ? (byte)1 : graphMixedLinePos);

            // theme
            if (_report.GraphTheme != null && _report.GraphTheme != "")
            {
                _chCtrl.AppearanceName = _report.GraphTheme;
            }

            // create series
            for (int i = 0; i < seriesPosCount; i++)
            {
                string name = "";
                for (int j = 0; j < seriesMemCount; j++)
                {
                    name += (j == 0 ? "" : " | ") + (pivotAxes ? _report.Cellset.GetCellsetMember(1, j, i).Name : _report.Cellset.GetCellsetMember(0, j, i).Name);
                }

                Series series = new Series();
                series.Name = name;


                // type
                if (_report.GraphType == OlapReport.GraphTypeEnum.Pie || _report.GraphType == OlapReport.GraphTypeEnum.PieBrokenApart)
                {
                    // if pie, each of series is displayed as individual graph
                    if (_report.GraphType == OlapReport.GraphTypeEnum.PieBrokenApart)
                    {
                        _chCtrl.Series.Clear();
                    }
                    _chCtrl.Series.Add(series);

                    series.ChangeView(ViewType.Pie);

                    PiePointOptions ppo = (PiePointOptions)series.PointOptions;
                    PieSeriesView   psw = (PieSeriesView)series.View;
                    PieSeriesLabel  psl = (PieSeriesLabel)series.Label;

                    psl.Position = PieSeriesLabelPosition.TwoColumns;
                    series.PointOptions.PointView = PointView.Undefined;

                    if (_report.GraphType == OlapReport.GraphTypeEnum.Pie)
                    {
                        SimpleDiagram sd = new SimpleDiagram();
                        sd.LayoutDirection = LayoutDirection.Horizontal;
                        sd.Dimension       = graphPieColumns;
                        _chCtrl.Diagram    = sd;
                    }

                    // legend
                    if (showCats)
                    {
                        _chCtrl.Legend.Visible = false;
                    }

                    series.Label.OverlappingOptions.ResolveOverlapping = true;
                    series.LegendPointOptions.PointView = PointView.Argument;

                    _chCtrl.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Center;
                    _chCtrl.Legend.AlignmentVertical   = LegendAlignmentVertical.BottomOutside;
                    _chCtrl.Legend.Direction           = LegendDirection.LeftToRight;


                    // series title
                    SeriesTitle sTitle = new SeriesTitle();
                    sTitle.Text      = name;
                    sTitle.Alignment = StringAlignment.Center;
                    sTitle.Dock      = ChartTitleDockStyle.Bottom;
                    psw.Titles.Add(sTitle);
                }
                else
                {
                    // diagram
                    if (_chCtrl.Diagram == null)
                    {
                        _chCtrl.Diagram = new XYDiagram();
                    }
                    XYDiagram diag = (XYDiagram)_chCtrl.Diagram;


                    //// panes
                    //if (_report.GraphType == OlapReport.GraphTypeEnum.LineWithBars && graphMixedLinePos <= seriesPosCount && diag.Panes.Count == 0)
                    //{
                    //    // add new pane
                    //    XYDiagramPane pane = new XYDiagramPane();
                    //    pane.Visible = true;
                    //    pane.SizeMode = PaneSizeMode.UseWeight;
                    //    pane.Weight = 0.66;
                    //    diag.PaneLayoutDirection = PaneLayoutDirection.Vertical;
                    //    diag.Panes.Add(pane);

                    //    // set default pane weight
                    //    diag.DefaultPane.SizeMode = PaneSizeMode.UseWeight;
                    //    diag.DefaultPane.Weight = 0.33;
                    //}

                    // add series
                    _chCtrl.Series.Add(series);

                    // add series to secondary pane if needed (in case of LineWithBars)
                    if (diag.Panes.Count > 0 && i != graphMixedLinePos - 1)
                    {
                        ((XYDiagramSeriesViewBase)series.View).Pane = diag.Panes[0];
                    }

                    if (_report.GraphType == OlapReport.GraphTypeEnum.BarVertical)
                    {
                        series.ChangeView(ViewType.Bar);
                    }
                    else if (_report.GraphType == OlapReport.GraphTypeEnum.BarHorizontal)
                    {
                        series.ChangeView(ViewType.Bar);
                        rotateGraph = true;
                    }
                    else if (_report.GraphType == OlapReport.GraphTypeEnum.StackedBarVertical)
                    {
                        series.ChangeView(ViewType.StackedBar);
                    }
                    else if (_report.GraphType == OlapReport.GraphTypeEnum.StackedBarHorizontal)
                    {
                        series.ChangeView(ViewType.StackedBar);
                        rotateGraph = true;
                    }
                    else if (_report.GraphType == OlapReport.GraphTypeEnum.LineHorizontal)
                    {
                        series.ChangeView(ViewType.Line);
                    }
                    else if (_report.GraphType == OlapReport.GraphTypeEnum.LineWithBars)
                    {
                        if (i == graphMixedLinePos - 1)
                        {
                            //if (!setScaling)
                            //{
                            //    // create secondary axis
                            //    SecondaryAxisY axisY = new SecondaryAxisY(series.Name);
                            //    axisY.Visible = true;
                            //    axisY.Title.Text = series.Name;
                            //    axisY.Title.Visible = true;
                            //    axisY.Alignment = AxisAlignment.Near;
                            //    ((XYDiagram)_chCtrl.Diagram).SecondaryAxesY.Add(axisY);
                            //    ((XYDiagramSeriesViewBase)series.View).AxisY = axisY;

                            //    // set default axis title
                            //    ((XYDiagram)_chCtrl.Diagram).AxisY.Title.Text = "Bar axis";
                            //    ((XYDiagram)_chCtrl.Diagram).AxisY.Title.Visible = true;
                            //}

                            // change view
                            series.ChangeView(ViewType.Line);
                        }
                        else
                        {
                            series.ChangeView(ViewType.Bar);
                        }
                    }

                    // 20 pixels per label (250 pixels for legend), othervise overlapping resolution will never finish
                    if ((size.Width - 250) / catPosCount > 20)
                    {
                        series.Label.OverlappingOptions.ResolveOverlapping = true;
                        PointOverlappingOptions poo = series.Label.OverlappingOptions as PointOverlappingOptions;
                        if (poo != null)
                        {
                            poo.AttractToMarker = true;
                        }
                    }

                    series.LegendText                   = name;
                    series.ShowInLegend                 = true;
                    series.ValueScaleType               = ScaleType.Numerical;
                    series.PointOptions.PointView       = PointView.Undefined;
                    series.LegendPointOptions.PointView = PointView.SeriesName;
                    series.Visible = true;

                    // labels orientation
                    diag.Rotated = rotateGraph;
                    if (rotateGraph)
                    {
                        diag.AxisY.Label.Antialiasing = true;
                        diag.AxisY.Label.Angle        = 315;
                    }
                    else
                    {
                        diag.AxisX.Label.Antialiasing = true;
                        diag.AxisX.Label.Angle        = 315;
                    }

                    // if scaling
                    if (setScaling)
                    {
                        diag.AxisY.Visible = false;
                    }
                }


                // prepare scaling ranges
                double scalingMin = double.MaxValue;
                double scalingMax = double.MinValue;
                if (setScaling)
                {
                    for (int l = 0; l < catPosCount; l++)
                    {
                        string val  = (pivotAxes ? _report.Cellset.GetCell(l, i).Value : _report.Cellset.GetCell(i, l).Value);
                        double dVal = 0;
                        double.TryParse(val, System.Globalization.NumberStyles.Float, System.Globalization.NumberFormatInfo.InvariantInfo, out dVal);
                        if (dVal < scalingMin)
                        {
                            scalingMin = dVal;
                        }
                        if (dVal > scalingMax)
                        {
                            scalingMax = dVal;
                        }
                    }
                }
                scalingMin = scalingMin - (scalingMax - scalingMin) * 0.1;

                // set data
                double percSum = 0;
                for (int l = 0; l < catPosCount; l++)
                {
                    string argument = "";
                    for (int m = 0; m < catMemCount; m++)
                    {
                        argument += (m == 0 ? "" : " | ") + (pivotAxes ? _report.Cellset.GetCellsetMember(0, m, l).Name : _report.Cellset.GetCellsetMember(1, m, l).Name);
                    }

                    string val = (pivotAxes ? _report.Cellset.GetCell(l, i).Value : _report.Cellset.GetCell(i, l).Value);

                    double dVal = 0;
                    double.TryParse(val, System.Globalization.NumberStyles.Float, System.Globalization.NumberFormatInfo.InvariantInfo, out dVal);
                    if (setPerc)
                    {
                        percSum += dVal;
                    }
                    else if (setScaling)
                    {
                        dVal = (scalingMax - scalingMin == 0 ? 0 : (dVal - scalingMin) / (scalingMax - scalingMin));
                    }

                    string fVal = (pivotAxes ? _report.Cellset.GetCell(l, i).FormattedValue : _report.Cellset.GetCell(i, l).FormattedValue);

                    SeriesPoint sp = new SeriesPoint(argument, new double[] { dVal });
                    sp.Tag = fVal;
                    series.Points.Add(sp);
                }

                // set custom labels and value as percentage
                for (int l = 0; l < catPosCount; l++)
                {
                    SeriesPoint sp = series.Points[l];
                    if (setPerc)
                    {
                        sp.Values[0] = sp.Values[0] / percSum;
                        sp.Tag       = sp.Values[0].ToString("P");
                    }

                    // custom point label
                    string customLabel = string.Empty;
                    if (!showValues && !showSeries && !showCats)
                    {
                        series.Label.Visible = false;
                    }
                    else
                    {
                        string fVal = (string)sp.Tag;
                        if (fVal == null || fVal == "")
                        {
                            fVal = "0";
                        }
                        customLabel  = (showSeries ? series.Name : string.Empty);
                        customLabel += (showCats ? (customLabel != string.Empty ? " | " : string.Empty) + sp.Argument : string.Empty);
                        customLabel += (showValues ? (customLabel != string.Empty ? ": " : string.Empty) + fVal : string.Empty);
                    }

                    series.Points[l].Tag = customLabel;
                }

                // for pie, layout each of series individually
                if (_report.GraphType == OlapReport.GraphTypeEnum.PieBrokenApart)
                {
                    _chCtrl.Titles.Clear();
                    _chCtrl.EndInit();
                    LayoutGraph(_report.ID.ToString() + "." + i.ToString(), size, graphPieColumns);

                    // init next chart
                    if (i < seriesPosCount - 1)
                    {
                        _chCtrl = new DevExpress.XtraCharts.Web.WebChartControl();
                        _chCtrl.BeginInit();
                    }
                }
            }


            int t2 = System.Environment.TickCount;

            if (_report.GraphType != OlapReport.GraphTypeEnum.PieBrokenApart)
            {
                ChartTitle title = new ChartTitle();
                title.Alignment = StringAlignment.Center;
                title.Lines     = new string[] { _report.Name, _report.Description };
                _chCtrl.Titles.Add(title);

                LayoutGraph(_report.ID.ToString(), size, 0);
            }

            // if LineWithBars
            if (_report.GraphType == OlapReport.GraphTypeEnum.LineWithBars)
            {
                // fill combo
                for (int i = 0; i < _chCtrl.Series.Count; i++)
                {
                    this.selMixedLinePos.Items.Add(new ListItem(_chCtrl.Series[i].Name, (i + 1).ToString()));
                }
                this.selMixedLinePos.SelectedIndex = graphMixedLinePos - 1;

                // set line as last
                if (!(_chCtrl.Series[_chCtrl.Series.Count - 1].View is LineSeriesView))
                {
                    // roll down through series
                    for (int i = graphMixedLinePos - 1; i < _chCtrl.Series.Count - 1; i++)
                    {
                        _chCtrl.Series.Swap(i, i + 1);
                    }
                }
            }

            int    t3    = System.Environment.TickCount;
            double time1 = (t3 - t2) / 1000.0;
            double time2 = (t2 - t1) / 1000.0;

            t1 = 0;
        }
Ejemplo n.º 11
0
        protected internal virtual void SetupChartSeriesTitle(SCChart chart, string text, SeriesTitle title)
        {
            title.Alignment          = Alignment;
            title.EnableAntialiasing = DefaultBoolean.True;
            title.Text       = text;
            title.Visibility = DefaultBoolean.True;
            title.WordWrap   = WordWrap;

            if (Dock.HasValue)
            {
                title.Dock = (DevExpress.XtraCharts.ChartTitleDockStyle)Dock.Value;
            }
            if (Indent.HasValue)
            {
                title.Indent = Indent.Value;
            }

            var font = Utils.StringToFont(Font, out Color fontColor);

            if (font != null)
            {
                title.Font = font;
            }
            if (fontColor != Color.Empty)
            {
                title.TextColor = fontColor;
            }
        }
Ejemplo n.º 12
0
        public void SetGraphForGroups()
        {
            GroupsWebChart.Series.Clear();
            DataTable dt = new DataTable();

            dt = VSWebBL.DashboardBL.Office365BL.Ins.GetOffice365GroupCount();
            GroupsWebChart.DataSource = dt;
            Series        series       = null;
            List <Series> serieslist   = new List <Series>();
            string        groupName    = "";
            string        groupType    = "";
            string        groupNameNew = "";
            string        groupTypeNew = "";
            SeriesTitle   title;

            if (dt.Rows.Count > 0)
            {
                bool seriesadded = false;
                groupName = dt.Rows[0]["GroupName"].ToString();
                groupType = dt.Rows[0]["GroupType"].ToString();
                series    = new Series(groupType, ViewType.Pie3D);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    groupNameNew = dt.Rows[i]["GroupName"].ToString();
                    groupTypeNew = dt.Rows[i]["GroupType"].ToString();
                    //5/31/2016 NS added for VSPLUS-3007
                    title      = new SeriesTitle();
                    title.Text = string.Format("{0}", groupType);

                    if (groupType != groupTypeNew)
                    {
                        if (series != null && !seriesadded)
                        {
                            series.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True;
                            Pie3DSeriesLabel label = (Pie3DSeriesLabel)series.Label;
                            label.TextPattern        = "{A}: {VP:P0}";
                            label.Position           = PieSeriesLabelPosition.TwoColumns;
                            series.LegendTextPattern = "{A}: {V}";
                            //5/31/2016 NS added for VSPLUS-3007
                            ((Pie3DSeriesView)series.View).Titles.Add(title);
                            GroupsWebChart.Series.Add(series);
                            //5/31/2016 NS added for VSPLUS-3007
                            groupType = groupTypeNew;
                        }
                        series = GroupsWebChart.Series[groupTypeNew];

                        if (series == null)
                        {
                            seriesadded = false;
                            series      = new Series(groupTypeNew, ViewType.Pie3D);
                        }
                        else
                        {
                            seriesadded = true;
                        }
                        series.ArgumentDataMember = dt.Columns["GroupName"].ToString();
                        series.ArgumentScaleType  = ScaleType.Qualitative;
                        series.ValueScaleType     = ScaleType.Numerical;
                    }
                    if (series != null)
                    {
                        series.Points.Add(new SeriesPoint(groupNameNew, Convert.ToDouble(dt.Rows[i]["GroupCount"].ToString())));
                    }
                }
                //5/31/2016 NS added for VSPLUS-3007
                groupType  = groupTypeNew;
                title      = new SeriesTitle();
                title.Text = string.Format("{0}", groupType);
                if (series != null && !seriesadded)
                {
                    series.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True;
                    Pie3DSeriesLabel label = (Pie3DSeriesLabel)series.Label;
                    label.TextPattern        = "{A}: {VP:P0}";
                    label.Position           = PieSeriesLabelPosition.TwoColumns;
                    series.LegendTextPattern = "{A}: {V}";
                    //5/31/2016 NS added for VSPLUS-3007
                    ((Pie3DSeriesView)series.View).Titles.Add(title);
                    GroupsWebChart.Series.Add(series);
                }
            }
        }
Ejemplo n.º 13
0
        public bool IsTemplateForReference(ConditionalTemplate template, Citation citation)
        {
            //Other work in the same series was cited before
            if (citation == null)
            {
                return(false);
            }

            var currentPlaceholderCitation = citation as PlaceholderCitation;

            if (currentPlaceholderCitation == null)
            {
                return(false);
            }

            Reference   currentReference = currentPlaceholderCitation.Reference;
            SeriesTitle currentSeries    = currentReference.SeriesTitle;

            if (currentSeries == null && currentReference.ParentReference != null)
            {
                currentSeries = currentReference.ParentReference.SeriesTitle;
            }
            if (currentSeries == null)
            {
                return(false);
            }


            // regarding placeholderCitation.PersonOnly: see comment for RepeatingInTextCitation
            if (currentPlaceholderCitation.RuleSetOverride != RuleSetOverride.None)
            {
                return(false);
            }
            if (currentPlaceholderCitation.YearOnly)
            {
                return(false);
            }


            CitationManager citationManager = currentPlaceholderCitation.CitationManager;

            if (citationManager == null)
            {
                return(false);
            }

            // we iterate over placeholder citations inside the same ruleset ONLY, i.e. in-text citations OR footnote citations
            IEnumerable <PlaceholderCitation> otherPlaceholderCitations = null;

            if (currentPlaceholderCitation.CitationType == CitationType.Footnote)
            {
                otherPlaceholderCitations = citationManager.FootnoteCitations.Select(item => item as PlaceholderCitation);
            }
            else if (currentPlaceholderCitation.CitationType == CitationType.InText)
            {
                otherPlaceholderCitations = citationManager.InTextCitations.Select(item => item as PlaceholderCitation);
            }


            foreach (PlaceholderCitation otherPlaceholderCitation in otherPlaceholderCitations)
            {
                if (otherPlaceholderCitation == currentPlaceholderCitation)
                {
                    break;                                                         //we just look in the direction of the beginning of the document
                }
                Reference otherReference = otherPlaceholderCitation.Reference;
                if (otherReference == null)
                {
                    continue;
                }

                SeriesTitle otherSeries = otherReference.SeriesTitle;
                if (otherSeries == null && otherReference.ParentReference != null)
                {
                    otherSeries = otherReference.ParentReference.SeriesTitle;
                }
                if (otherSeries == null)
                {
                    continue;
                }

                if (otherSeries == currentSeries && otherReference != currentReference)
                {
                    return(true);
                }
            }

            //still here? nothing found, return false
            return(false);
        }
        private void load_data_to_chart()
        {
            m_chart.DataSource = m_ds.Tables[0];
            m_chart.SeriesDataMember = "GIOI_TINH";
            m_chart.SeriesTemplate.ArgumentDataMember = "QUOC_TICH";
            m_chart.SeriesTemplate.SummaryFunction = "COUNT()";

            var v_ssv = new PieSeriesView();
            m_chart.SeriesTemplate.View = v_ssv;
            foreach (Series item in m_chart.Series)
            {
                item.ShowInLegend = true;
                item.LegendText = item.Name;
                item.LegendTextPattern = "{S} - {A} : {VP:0.##%} ({V} Lao động)";
                item.Label.TextPattern = "{A}";
                SeriesTitle st = new SeriesTitle();
                st.Text = item.Name;
                st.Dock = ChartTitleDockStyle.Bottom;
                ((PieSeriesView)item.View).Titles.Add(st);
            }
        }