Super 2d/3d Graph Library

Enhance your .NET application adding nice charts within minutes! Save time and money!


Example 22: Assigning colors to Series and Items

 

Data in charts are grouped in series. Each serie contains a list of items (for example, in a bar chart all bars are items).

You may assign a color to each serie with SeriesColor property so all items in a serie will share the same color. But you may also assign a color to each item separately (with ItemsColor property).

As SeriesColor has been used in other samples, this tutorial will demonstrate ItemsColor only.

 

The sample code uses SeriesFactory helper class to add data to chart. For each item (bar) added, a ItemColor is specified at the same time.

 

Steps:

1. Create a new Windows application project (VB.NET)

2. Add Super 2d/3d Graph Library to the toolbox pallete and drag two charts to Form1

3. Copy and paste de following code:

 


Form Code


Imports
Super2d3dGraphLibrary

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

   Dim sf As New SeriesFactory

   For itemindex As Integer = 0 To 5

      sf.AddValue(Rnd() * 50)   ' Add a random value

      Dim myColor As Color ' Assign a random color to this item
      myColor = Color.FromArgb(Rnd() * 255, Rnd() * 255, Rnd() * 255)
      sf.ItemColor(myColor)

   Next
   sf.ApplyTo(Super2D3dGraph1)
  ' Apply settings and refresh chart

End Sub

End Class


 

Result:


 

 

License & Purchase Info


Current version: 14

Super 2d/3d Graph Library is available as:
-Standard License (99€)
-Premium License (149€)
-Enterprise License (299€)

Click here for more details & purchase

Contact Info


Feel free to contact us
for questions related to any of our products or custom .Net development. We usually respond in the same labor day.

Software Siglo XXI

Main support service: support@softwaresigloxxi.com

Sales and other enquiries: contact@softwaresigloxxi.com