Tutorial 42: Using Hatch Styles in Pie charts
« on: February 05, 2016, 01:20:49 AM »
Hatch styles are very useful when you don't/can't want use colors (eg. monochrome printing):

Steps to run this sample:

1. Create a new Windows application project (VB.NET)
2. Add Crossing Charts Library to the toolbox pallete and drag a chart to Form1.
3. Copy and paste de following code:
 
Code: [Select]
Imports System.Drawing.Drawing2D
Imports CrossingChartsLibrary
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
  sf.AddValue(35)
  sf.AddValue(15)
  sf.AddValue(20)
  sf.AddValue(25)
  sf.AddValue(40)
  sf.AddValue(7)
  With CrossingCharts1
    .Style = STYLE2D3D.STYLE2D_PIE
    .Series = sf.Series
    Dim hb1 As HatchBrush = New HatchBrush(HatchStyle.LightUpwardDiagonal, Color.White)
    Dim hb2 As HatchBrush = New HatchBrush(HatchStyle.LargeGrid, Color.White)
    Dim hb3 As HatchBrush = New HatchBrush(HatchStyle.Cross, Color.White)
    Dim hb4 As HatchBrush = New HatchBrush(HatchStyle.DarkVertical, Color.White)
    Dim hb5 As HatchBrush = New HatchBrush(HatchStyle.DiagonalBrick, Color.White)
    Dim hb6 As HatchBrush = New HatchBrush(HatchStyle.DottedGrid, Color.White)
    .CastShadows = False
    .SeriesFillStyle = New HatchBrush() {hb1, hb2, hb3, hb4, hb5, hb6}
    .ShowLegendInDataTable = False
    .ShowItemsLegend = True
    .ItemsLegend = New String() {"Source 1", "Source 2", "Source 3", "Source 4", "Source 5", "Source 6"}
    .RefreshChart()
  End With
End Sub
End Class

Results:

« Last Edit: February 16, 2016, 11:13:54 AM by CrossingCharts »