Tutorial 17: Labels - SeriesLegend vs ItemsLegend
« on: February 04, 2016, 02:51:49 PM »
This is a quick SeriesLegend and ItemsLegend properties sample:

  • SeriesLegend is used to group a list of values by the same color.
    Items
  • Legend is used to assign a label to each group of values of different series.

Take a look at the following sample:

Steps:

1. Create a new Windows application project (VB.NET)
2. Add Crossing Charts Library to the toolbox palette and drag it to Form1.
3. Copy and paste de following code:

Note: the code in the Form1_Load event could be used in ASP.NET applications as well.

Code: [Select]
Imports CrossingChartsLibrary
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
   Dim myData(2) As ArrayList
   ' Some quick random data...
   myData(0) = New ArrayList
   myData(0).Add(15)
   myData(0).Add(17)
   myData(0).Add(24)
   myData(1) = New ArrayList
   myData(1).Add(5)
   myData(1).Add(23)
   myData(1).Add(28)
   myData(2) = New ArrayList
   myData(2).Add(12)
   myData(2).Add(18)
   myData(2).Add(19)
   With CrossingCharts1
      ' General appearance
      .Title = "PETS SOLD!"
      .Series = myData
      .ShowDataTable = False
      .Style = STYLE2D3D.STYLE2D_ACUM_FIXED
      .WallsBackStyle =
             STYLEWALLBACKGROUND.STYLEWALLBACKGROUND_TRANSPARENT
      .BackStyle =
          STYLEBACKGROUND.STYLEBACKGROUND_GRADIENT_TUBULAR_INVERTED
      ' Yaxis look & feel
      .YAxisTitle = "Units"
      .YAxisDividersCount = 5
      .YAxisNumericFormat = "0"   ' <- No decimals
      ' Values look & feel
      .ValuesFormat = "0"   ' <- No decimals
      .ValuesBackColor = Color.LightSkyBlue
      ' Legend look & feel
      .Thickness = 90
      .SeriesLegend = New String() {"Cats", "Dogs", "Birds"}
      .SeriesColor = New Color()
                        {Color.Yellow, Color.Brown, Color.Cyan}
      .LegendAlignment = STYLEALIGNMENT.STYLEALIGNMENT_TOP_CENTER
      .LegendText = ""   ' <- Hide legend title
      .ShowLegend = True
      ' X-Axis look & feel
      .ItemsLegend = New String()
                 {"October 2006", "November 2006", "December 2006"}
      .ShowItemsLegend = True
      .XAxisTitle = "Month"
      .ShowXAxis = True
      .RefreshChart()
   End With
End Sub
End Class

Results:

« Last Edit: February 16, 2016, 09:29:39 AM by CrossingCharts »