Spread WPF 14
GrapeCity.Windows.SpreadSheet.Data Namespace / SpreadChart Class / Legend Property
Example


In This Topic
    Legend Property (SpreadChart)
    In This Topic
    Gets or sets the legend.
    Syntax
    'Declaration
     
    Public Property Legend As Legend
    'Usage
     
    Dim instance As SpreadChart
    Dim value As Legend
     
    instance.Legend = value
     
    value = instance.Legend
    public Legend Legend {get; set;}

    Property Value

    The legend of the chart.
    Remarks
    The legend area can contain legend items, background, and border.
    Example
    This example sets the Legend property.
    GrapeCity.Windows.SpreadSheet.Data.SpreadBubbleSeries series0 = new GrapeCity.Windows.SpreadSheet.Data.SpreadBubbleSeries();
    series0.Name = "Series 0";
    series0.XValues.Add(1.0);
    series0.XValues.Add(2.0);
    series0.XValues.Add(4.0);
    series0.XValues.Add(8.0);
    series0.Values.Add(2.0);
    series0.Values.Add(4.0);
    series0.Values.Add(3.0);
    series0.Values.Add(5.0);
    series0.SizeValues.Add(1.0);
    series0.SizeValues.Add(2.0);
    series0.SizeValues.Add(1.0);
    series0.SizeValues.Add(2.0);
    GrapeCity.Windows.SpreadSheet.Data.SpreadBubbleSeries series1 = new GrapeCity.Windows.SpreadSheet.Data.SpreadBubbleSeries();
    series1.Name = "Series 1";
    series1.XValues.Add(1.0);
    series1.XValues.Add(3.0);
    series1.XValues.Add(5.0);
    series1.XValues.Add(8.0);
    series1.Values.Add(1.0);
    series1.Values.Add(2.0);
    series1.Values.Add(4.0);
    series1.Values.Add(8.0);
    series1.SizeValues.Add(4.0);
    series1.SizeValues.Add(3.0);
    series1.SizeValues.Add(4.0);
    series1.SizeValues.Add(3.0);
    
    GrapeCity.Windows.SpreadSheet.Data.ChartTitle label = new GrapeCity.Windows.SpreadSheet.Data.ChartTitle();
    label.Text = "XYZ Point Chart";
    label.FontSize = 10;
    label.FontFamily = new FontFamily("Tahoma");
    GrapeCity.Windows.SpreadSheet.Data.Legend l = new GrapeCity.Windows.SpreadSheet.Data.Legend();
    l.Alignment = GrapeCity.Windows.SpreadSheet.Data.LegendAlignment.TopLeft;
    GrapeCity.Windows.SpreadSheet.Data.SpreadChart chart = new GrapeCity.Windows.SpreadSheet.Data.SpreadChart();
    chart.ChartTitle = label;
    chart.Legend = l;
    chart.DataSeries.Add(series0);
    chart.DataSeries.Add(series1);
    chart.ChartType = GrapeCity.Windows.SpreadSheet.Data.SpreadChartType.Bubble;
    chart.Name = "name1";
    this.gcSpreadSheet1.ActiveSheet.Charts.Add(chart);
    Dim series0 As New GrapeCity.Windows.SpreadSheet.Data.SpreadBubbleSeries()
    series0.Name = "Series 0"
    series0.XValues.Add(1.0)
    series0.XValues.Add(2.0)
    series0.XValues.Add(4.0)
    series0.XValues.Add(8.0)
    series0.Values.Add(2.0)
    series0.Values.Add(4.0)
    series0.Values.Add(3.0)
    series0.Values.Add(5.0)
    series0.SizeValues.Add(1.0)
    series0.SizeValues.Add(2.0)
    series0.SizeValues.Add(1.0)
    series0.SizeValues.Add(2.0)
    Dim series1 As New GrapeCity.Windows.SpreadSheet.Data.SpreadBubbleSeries()
    series1.Name = "Series 1"
    series1.XValues.Add(1.0)
    series1.XValues.Add(3.0)
    series1.XValues.Add(5.0)
    series1.XValues.Add(8.0)
    series1.Values.Add(1.0)
    series1.Values.Add(2.0)
    series1.Values.Add(4.0)
    series1.Values.Add(8.0)
    series1.SizeValues.Add(4.0)
    series1.SizeValues.Add(3.0)
    series1.SizeValues.Add(4.0)
    series1.SizeValues.Add(3.0)
    
    Dim label As New GrapeCity.Windows.SpreadSheet.Data.ChartTitle()
    label.Text = "XYZ Point Chart"
    label.FontSize = 10
    label.FontFamily = New FontFamily("Tahoma")
    Dim l As New GrapeCity.Windows.SpreadSheet.Data.Legend()
    l.Alignment = GrapeCity.Windows.SpreadSheet.Data.LegendAlignment.TopLeft
    Dim chart As New GrapeCity.Windows.SpreadSheet.Data.SpreadChart()
    chart.ChartTitle = label
    chart.Legend = l
    chart.DataSeries.Add(series0)
    chart.DataSeries.Add(series1)
    chart.ChartType = GrapeCity.Windows.SpreadSheet.Data.SpreadChartType.Bubble
    chart.Name = "name1"
    GcSpreadSheet1.ActiveSheet.Charts.Add(chart)
    See Also