Tutorial 35: XYZ scatter chart (loading data from Excel)
« on: February 04, 2016, 03:46:38 PM »
This sampe code will plot a bunch of points in 3D space using X/Y/Z coordinates.
Data is loaded from an Excel spreadsheet which must preserve the following columns (Series, X, Y, Z):



Column Series will serve to group data in different series (so you can make each serie looks in different colors). Values can range from 0 to n.
 
Steps:

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

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 sf As New SeriesFactory
  sf.AddPointsFromFile("c:\sample.xls")  ' provide your own data file!
  With CrossingCharts1
    .Style = STYLE2D3D.STYLE3D_XYZ_SCATTER
    .ShowDataTable = False
    .ShowValues = False
    .WallsBackStyle = STYLEWALLBACKGROUND.STYLEWALLBACKGROUND_TRANSPARENT
    .WallStyle = STYLEWALLS.STYLEWALLS_BOXED
    .HotSpotsEnabled = False
    .ShowXAxis = True
    .ShowYAxis = True
    .ShowZAxis = True
    .ShowDividersX = True
    .ShowDividersZ = True
    .YAxisDividersCount = 4
    .XAxisDividersCount = 4
    .ZAxisDividersCount = 4
    .LegendAlignment = STYLEALIGNMENT.STYLEALIGNMENT_BOTTOM_CENTER
    .MarginLeft = 50
    .MarginRight = 50
    .MarginBottom = 50
    .PointSize = 2
    .SeriesColor = New Color() {Color.Red, Color.LightGreen}
    .Series = sf.Series
    .RefreshChart()
  End With
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  CrossingCharts1.YAxisAngle += 0.01
  CrossingCharts1.RefreshChart()
End Sub
Private Sub btRotate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btRotate.Click
  Timer1.Enabled = True
End Sub
End Class

Results:

« Last Edit: February 16, 2016, 11:07:02 AM by CrossingCharts »