コード例 #1
0
        /// <summary>
        /// Creates a data label rendererInfo.
        /// Does not return any renderer info.
        /// </summary>
        internal override RendererInfo Init()
        {
            ChartRendererInfo cri = (ChartRendererInfo)_rendererParms.RendererInfo;
            foreach (SeriesRendererInfo sri in cri.seriesRendererInfos)
            {
                if (cri._chart._hasDataLabel || cri._chart._dataLabel != null ||
                    sri._series._hasDataLabel || sri._series._dataLabel != null)
                {
                    DataLabelRendererInfo dlri = new DataLabelRendererInfo();

                    DataLabel dl = sri._series._dataLabel;
                    if (dl == null)
                        dl = cri._chart._dataLabel;
                    if (dl == null)
                    {
                        dlri.Format = "0";
                        dlri.Font = cri.DefaultDataLabelFont;
                        dlri.FontColor = new XSolidBrush(XColors.Black);
                        dlri.Position = DataLabelPosition.InsideEnd;
                        if (cri._chart._type == ChartType.Pie2D || cri._chart._type == ChartType.PieExploded2D)
                            dlri.Type = DataLabelType.Percent;
                        else
                            dlri.Type = DataLabelType.Value;
                    }
                    else
                    {
                        dlri.Format = dl.Format.Length > 0 ? dl.Format : "0";
                        dlri.Font = Converter.ToXFont(dl._font, cri.DefaultDataLabelFont);
                        dlri.FontColor = Converter.ToXBrush(dl._font, XColors.Black);
                        if (dl._positionInitialized)
                            dlri.Position = dl._position;
                        else
                            dlri.Position = DataLabelPosition.OutsideEnd;
                        if (dl._typeInitialized)
                            dlri.Type = dl._type;
                        else
                        {
                            if (cri._chart._type == ChartType.Pie2D || cri._chart._type == ChartType.PieExploded2D)
                                dlri.Type = DataLabelType.Percent;
                            else
                                dlri.Type = DataLabelType.Value;
                        }
                    }

                    sri._dataLabelRendererInfo = dlri;
                }
            }

            return null;
        }
コード例 #2
0
    /// <summary>
    /// Creates a data label rendererInfo.
    /// Does not return any renderer info.
    /// </summary>
    internal override RendererInfo Init()
    {
      ChartRendererInfo cri = (ChartRendererInfo)this.rendererParms.RendererInfo;
      foreach (SeriesRendererInfo sri in cri.seriesRendererInfos)
      {
        if (cri.chart.hasDataLabel || cri.chart.dataLabel != null ||
            sri.series.hasDataLabel || sri.series.dataLabel != null)
        {
          DataLabelRendererInfo dlri = new DataLabelRendererInfo();

          DataLabel dl = sri.series.dataLabel;
          if (dl == null)
            dl = cri.chart.dataLabel;
          if (dl == null)
          {
            dlri.Format = "0";
            dlri.Font = cri.DefaultDataLabelFont;
            dlri.FontColor = new XSolidBrush(XColors.Black);
            dlri.Position = DataLabelPosition.InsideEnd;
            if (cri.chart.type == ChartType.Pie2D || cri.chart.type == ChartType.PieExploded2D)
              dlri.Type = DataLabelType.Percent;
            else
              dlri.Type = DataLabelType.Value;
          }
          else
          {
            dlri.Format = dl.Format.Length > 0 ? dl.Format : "0";
            dlri.Font = Converter.ToXFont(dl.font, cri.DefaultDataLabelFont);
            dlri.FontColor = Converter.ToXBrush(dl.font, XColors.Black);
            if (dl.positionInitialized)
              dlri.Position = dl.position;
            else
              dlri.Position = DataLabelPosition.OutsideEnd;
            if (dl.typeInitialized)
              dlri.Type = dl.type;
            else
            {
              if (cri.chart.type == ChartType.Pie2D || cri.chart.type == ChartType.PieExploded2D)
                dlri.Type = DataLabelType.Percent;
              else
                dlri.Type = DataLabelType.Value;
            }
          }

          sri.dataLabelRendererInfo = dlri;
        }
      }

      return null;
    }