Пример #1
0
        protected virtual Shape CreateLineShape(DataSeries ds)
        {
            Shape        sh = null;
            IPlotElement connectionElement = ds.GetConnectionElement(this, clear);

            if (connectionElement != null)
            {
                sh = connectionElement.LegendShape;
            }
            if (sh == null)
            {
                Rectangle rectangle = new Rectangle();
                sh = rectangle;
            }
            if (ds.ConnectionShape != null)
            {
                ds.ConnectionShape.Apply(sh);
            }
            return(sh);
        }
Пример #2
0
 internal virtual void UpdateLegend(IList <LegendItem> litems)
 {
     using (IEnumerator <LegendItem> enumerator = litems.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             enumerator.Current.Clear();
         }
     }
     litems.Clear();
     if (ColorScheme == Dt.Charts.ColorScheme.Point)
     {
         AnalyzeData(IsStacked);
         int nser = _dataInfo.nser;
         int npts = _dataInfo.npts;
         if (nser > 0)
         {
             DataSeries series = Series[0] as DataSeries;
             for (int i = 0; i < npts; i++)
             {
                 ShapeStyle shapeStyle = StyleGen.GetStyle(i);
                 string     lbl        = null;
                 object     item       = null;
                 if ((ItemNames != null) && (i < ItemNames.Length))
                 {
                     item = ItemNames[i];
                     if (item != null)
                     {
                         lbl = item.ToString();
                     }
                 }
                 else
                 {
                     lbl = "Item " + ((int)i).ToString((IFormatProvider)CultureInfo.CurrentCulture);
                 }
                 Shape sym = CreateSymbolShape(shapeStyle);
                 if (series.ReadLocalValue(DataSeries.SymbolStrokeProperty) != DependencyProperty.UnsetValue)
                 {
                     sym.Stroke = series.SymbolStroke;
                 }
                 if (series.ReadLocalValue(DataSeries.SymbolStrokeThicknessProperty) != DependencyProperty.UnsetValue)
                 {
                     sym.StrokeThickness = Math.Min(2.0, series.SymbolStrokeThickness);
                 }
                 LegendItem item2 = new LegendItem(sym, null, lbl, item);
                 litems.Add(item2);
             }
         }
     }
     else
     {
         int num4 = Series.Count;
         for (int j = 0; j < num4; j++)
         {
             DataSeries series2 = Series[j] as DataSeries;
             if (series2 != null)
             {
                 if ((series2.SymbolShape == null) || !_stgen.List.Contains(series2.SymbolShape))
                 {
                     series2.SymbolShape = _stgen.Next();
                 }
                 if (series2.ConnectionShape == null)
                 {
                     series2.ConnectionShape = _stgen.List2[_stgen.List.Count - 1];
                 }
                 if (((byte)(series2.Display & SeriesDisplay.HideLegend)) == 0)
                 {
                     LegendItem item3;
                     object     symbol     = Symbol;
                     object     connection = Connection;
                     if (series2.ChartType.HasValue)
                     {
                         ChartSubtype subtype = ChartTypes.GetSubtype(series2.ChartType.ToString());
                         symbol     = subtype.Symbol;
                         connection = subtype.Connection;
                     }
                     bool         flag              = (((symbol != null) && series2.IsDefaultSymbol) || (series2.Symbol != null)) || (series2.SymbolMarker != Marker.None);
                     bool         flag2             = ((connection != null) && series2.IsDefaultConnection) || (series2.Connection != null);
                     IPlotElement connectionElement = series2.GetConnectionElement(this, clear);
                     if ((!flag && flag2) && (connectionElement is Area))
                     {
                         item3 = new LegendItem(flag2 ? CreateLineShape(series2) : null, null, series2.Label, series2);
                     }
                     else
                     {
                         item3 = new LegendItem(flag ? CreateSymbolShape(series2) : null, flag2 ? CreateLineShape(series2) : null, series2.Label, series2);
                     }
                     litems.Add(item3);
                 }
             }
         }
         clear = false;
     }
 }