Infragistics Home

Infragistics Forums

Infragistics community online discussions.
Welcome to Infragistics Forums Sign in | FAQ
in Search

Composite Chart (Column and Line), Line Chart never appears

Last post 07-24-2008 8:30 by yannh. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 07-18-2008 10:14

    • yannh
    • Top 500 Contributor
    • Joined on 02-22-2008
    • Points 315

    Composite Chart (Column and Line), Line Chart never appears

    Hi,

    I'm currently working on a project that uses Composite Charts. I've seen a couple of examples on the forum and I tried to reproduce a Composite chart composed of a Column Chart and a Line chart. When I excute the code, I can see the Colums, the X and Y Axis of the column chart. I also obtain the X and Y2 axis for my Line chart, but I never see the line on my chart. The line never appear but the data is good and I don't really understand why it doesn't work. Can someone help me with this?

    Here's the code 
     

    The object chtMainGraph is my Infragistics.Win.UltraWinChart.UltraChart object

    The oCurrentGraph.GetData() returns this data

     Mois    CoutVoulu

     janvier       12
     février        15
     mars         18
     avril           21
     mai           24
     juin           27
     juillet         30
     août          33
     septembre 36
     octobre      39

    The oCurrentGraph.GetSecondaryData() returns

      Mois2    CoutVoulu2

     janvier        16
     février         20
     mars          24
     avril            28
     mai            32
     juin            36
     juillet          40
     août           44
     septembre  48
     octobre       52

    I checked the data and everything is valid

    ------------------------------------

    Dim area1 As New Infragistics.UltraChart.Resources.Appearance.ChartArea()

    chtMainGraph.CompositeChart.ChartAreas.Add(area1)

    Dim xaxis As New Infragistics.UltraChart.Resources.Appearance.AxisItem(chtMainGraph, UltraChart.Shared.Styles.AxisNumber.X_Axis)

    xaxis.OrientationType = UltraChart.Shared.Styles.AxisNumber.X_Axis

    xaxis.DataType = UltraChart.Shared.Styles.AxisDataType.String

    xaxis.Labels.ItemFormat = UltraChart.Shared.Styles.AxisItemLabelFormat.ItemLabel

    xaxis.SetLabelAxisType = UltraChart.Core.Layers.SetLabelAxisType.GroupBySeries

    xaxis.Labels.Layout.Behavior = UltraChart.Shared.Styles.AxisLabelLayoutBehaviors.Auto

    xaxis.Labels.Orientation = UltraChart.Shared.Styles.TextOrientation.Horizontal

    Dim yaxis As New Infragistics.UltraChart.Resources.Appearance.AxisItem(chtMainGraph, UltraChart.Shared.Styles.AxisNumber.Y_Axis)

    yaxis.OrientationType = UltraChart.Shared.Styles.AxisNumber.Y_Axis

    yaxis.DataType = UltraChart.Shared.Styles.AxisDataType.Numeric

    yaxis.Labels.ItemFormat = UltraChart.Shared.Styles.AxisItemLabelFormat.DataValue

    yaxis.SetLabelAxisType = UltraChart.Core.Layers.SetLabelAxisType.GroupBySeries

    yaxis.Labels.Layout.Behavior = UltraChart.Shared.Styles.AxisLabelLayoutBehaviors.Auto

    yaxis.Labels.Orientation = UltraChart.Shared.Styles.TextOrientation.Horizontal

    yaxis.RangeType = UltraChart.Shared.Styles.AxisRangeType.Custom

    yaxis.RangeMin = 0

    yaxis.RangeMax = 75

     

    Dim xaxis2 As New Infragistics.UltraChart.Resources.Appearance.AxisItem(chtMainGraph, UltraChart.Shared.Styles.AxisNumber.X_Axis)

    xaxis2.OrientationType = UltraChart.Shared.Styles.AxisNumber.X_Axis

    xaxis2.DataType = UltraChart.Shared.Styles.AxisDataType.String

    xaxis2.SetLabelAxisType = UltraChart.Core.Layers.SetLabelAxisType.ContinuousData

     

    Dim yaxis2 As New Infragistics.UltraChart.Resources.Appearance.AxisItem(chtMainGraph, UltraChart.Shared.Styles.AxisNumber.Y2_Axis)

    yaxis2.OrientationType = UltraChart.Shared.Styles.AxisNumber.Y2_Axis

    yaxis2.DataType = UltraChart.Shared.Styles.AxisDataType.Numeric

    yaxis2.Labels.ItemFormat = UltraChart.Shared.Styles.AxisItemLabelFormat.DataValue

    yaxis2.SetLabelAxisType = UltraChart.Core.Layers.SetLabelAxisType.ContinuousData

    yaxis2.RangeType = UltraChart.Shared.Styles.AxisRangeType.Custom

    yaxis2.RangeMin = 0

    yaxis2.RangeMax = 150

     

    chtMainGraph.ChartType = UltraChart.Shared.Styles.ChartType.Composite

    Dim seriesColumn As New UltraChart.Resources.Appearance.NumericSeriesDim seriesLine As New UltraChart.Resources.Appearance.NumericSeries

     

    Dim appearenceColumn As New UltraChart.Resources.Appearance.ChartLayerAppearance()

    Dim appearenceLine As New UltraChart.Resources.Appearance.ChartLayerAppearance()

    seriesColumn.Data.DataSource = oCurrentGraph.GetData()

    seriesColumn.Data.LabelColumn = "Mois"

    seriesColumn.Data.ValueColumn = "CoutVoulu"

    seriesLine.Data.DataSource = oCurrentGraph.GetSecondaryData()

    seriesLine.Data.LabelColumn = "Mois2"

    seriesLine.Data.ValueColumn = "CoutVoulu2"

    appearenceColumn.ChartType = UltraChart.Shared.Styles.ChartType.ColumnChart

    appearenceColumn.ChartArea = area1

    appearenceColumn.Series.Add(seriesColumn)

    appearenceColumn.AxisX = xaxis

    appearenceColumn.AxisY = yaxis

    appearenceLine.ChartType = UltraChart.Shared.Styles.ChartType.ColumnChart

    appearenceLine.ChartArea = area1

    appearenceLine.Series.Add(seriesLine)

    appearenceLine.AxisX = xaxis2

    appearenceLine.AxisY2 = yaxis2

    chtMainGraph.CompositeChart.ChartLayers.Add(appearenceColumn)

    chtMainGraph.CompositeChart.ChartLayers.Add(appearenceLine)

    area1.Axes.Add(xaxis)

    area1.Axes.Add(yaxis)

    area1.Axes.Add(xaxis2)

    area1.Axes.Add(yaxis2)

    chtMainGraph.Series.AddRange(New Infragistics.UltraChart.Data.Series.ISeries() {seriesLine, seriesColumn})

    chtMainGraph.Series.DataBind()

     

    The result I get is the image attached to this post

    Thanks for your answer.

     


    • Post Points: 35
  • 07-19-2008 2:46 In reply to

    • radi0505
    • Not Ranked
    • Joined on 07-19-2008
    • Points 5

    Re: Composite Chart (Column and Line), Line Chart never appears

    Hi,

    I'm facing the same problem. Hope that somebody will post an answer for this; it's not really easy to find your way through the help system.

    • Post Points: 5
  • 07-21-2008 15:00 In reply to

    Re: Composite Chart (Column and Line), Line Chart never appears

    Answer

    yannh,

     You are setting appearanceLine.axisX and axisY2 instead of axisY.  Change the one line of code to the following:

    appearenceLine.AxisY = yaxis2

    and you will see your second layer.  The second layer will be using the Y2 axis on the right as its Y axis.  On a side note, you have also set appearenceLine's ChartType to ColumnChart.  If you want to see a LineChart, change the ChartType to LineChart.

    • Post Points: 50
  • 07-21-2008 16:38 In reply to

    • yannh
    • Top 500 Contributor
    • Joined on 02-22-2008
    • Points 315

    Re: Composite Chart (Column and Line), Line Chart never appears

    Kim, I changed the lines you telled me but I get the same result. I never get the line on my graphic.

    Sorry for the ColumnChart ChartType on the appearenceLine, it was a copy/paste mistake I made when I copied the code on the forum.

    Here's my code with the modified lines if you want to look at it:

     

     

    Dim area1 As New Infragistics.UltraChart.Resources.Appearance.ChartArea()

    chtMainGraph.CompositeChart.ChartAreas.Add(area1)

    Dim xaxis As New Infragistics.UltraChart.Resources.Appearance.AxisItem(chtMainGraph, UltraChart.Shared.Styles.AxisNumber.X_Axis)

    xaxis.OrientationType = UltraChart.Shared.Styles.AxisNumber.X_Axis

    xaxis.DataType = UltraChart.Shared.Styles.AxisDataType.String

    xaxis.Labels.ItemFormat = UltraChart.Shared.Styles.AxisItemLabelFormat.ItemLabel

    xaxis.SetLabelAxisType = UltraChart.Core.Layers.SetLabelAxisType.GroupBySeries

    xaxis.Labels.Layout.Behavior = UltraChart.Shared.Styles.AxisLabelLayoutBehaviors.Auto

    xaxis.Labels.Orientation = UltraChart.Shared.Styles.TextOrientation.Horizontal

    Dim yaxis As New Infragistics.UltraChart.Resources.Appearance.AxisItem(chtMainGraph, UltraChart.Shared.Styles.AxisNumber.Y_Axis)

    yaxis.OrientationType = UltraChart.Shared.Styles.AxisNumber.Y2_Axis

    yaxis.DataType = UltraChart.Shared.Styles.AxisDataType.Numeric

    yaxis.Labels.ItemFormat = UltraChart.Shared.Styles.AxisItemLabelFormat.DataValue

    yaxis.SetLabelAxisType = UltraChart.Core.Layers.SetLabelAxisType.GroupBySeries

    yaxis.Labels.Layout.Behavior = UltraChart.Shared.Styles.AxisLabelLayoutBehaviors.Auto

    yaxis.Labels.Orientation = UltraChart.Shared.Styles.TextOrientation.Horizontal

    yaxis.RangeType = UltraChart.Shared.Styles.AxisRangeType.Custom

    yaxis.RangeMin = 0

    yaxis.RangeMax = 75

    Dim xaxis2 As New Infragistics.UltraChart.Resources.Appearance.AxisItem(chtMainGraph, UltraChart.Shared.Styles.AxisNumber.X_Axis)

    xaxis2.OrientationType = UltraChart.Shared.Styles.AxisNumber.X_Axis

    xaxis2.DataType = UltraChart.Shared.Styles.AxisDataType.String

    xaxis2.SetLabelAxisType = UltraChart.Core.Layers.SetLabelAxisType.ContinuousData

    Dim yaxis2 As New Infragistics.UltraChart.Resources.Appearance.AxisItem(chtMainGraph, UltraChart.Shared.Styles.AxisNumber.Y2_Axis)

    yaxis2.OrientationType = UltraChart.Shared.Styles.AxisNumber.Y_Axis

    yaxis2.DataType = UltraChart.Shared.Styles.AxisDataType.Numeric

    yaxis2.Labels.ItemFormat = UltraChart.Shared.Styles.AxisItemLabelFormat.DataValue

    yaxis2.SetLabelAxisType = UltraChart.Core.Layers.SetLabelAxisType.ContinuousData

    yaxis2.RangeType = UltraChart.Shared.Styles.AxisRangeType.Custom

    yaxis2.RangeMin = 0

    yaxis2.RangeMax = 150

    chtMainGraph.ChartType = UltraChart.Shared.Styles.ChartType.Composite

    Dim seriesColumn As New UltraChart.Resources.Appearance.NumericSeries

    Dim seriesLine As New UltraChart.Resources.Appearance.NumericSeries

    Dim appearenceColumn As New UltraChart.Resources.Appearance.ChartLayerAppearance()Dim appearenceLine As New UltraChart.Resources.Appearance.ChartLayerAppearance()

    seriesColumn.Data.DataSource = oCurrentGraph.GetData()

    seriesColumn.Data.LabelColumn = "Mois"

    seriesColumn.Data.ValueColumn = "CoutVoulu"

    seriesLine.Data.DataSource = oCurrentGraph.GetSecondaryData()

    seriesLine.Data.LabelColumn = "Mois2"

    seriesLine.Data.ValueColumn = "CoutVoulu2"

    appearenceColumn.ChartType = UltraChart.Shared.Styles.ChartType.ColumnChart

    appearenceColumn.ChartArea = area1

    appearenceColumn.Series.Add(seriesColumn)

    appearenceColumn.AxisX = xaxis

    appearenceColumn.AxisY = yaxis

    appearenceLine.ChartType = UltraChart.Shared.Styles.ChartType.LineChart

    appearenceLine.ChartArea = area1

    appearenceLine.Series.Add(seriesLine)

    appearenceLine.AxisX = xaxis2

    appearenceLine.AxisY = yaxis2

    chtMainGraph.CompositeChart.ChartLayers.Add(appearenceColumn)

    chtMainGraph.CompositeChart.ChartLayers.Add(appearenceLine)

    area1.Axes.Add(xaxis)

    area1.Axes.Add(yaxis)

    area1.Axes.Add(xaxis2)

    area1.Axes.Add(yaxis2)

    chtMainGraph.Series.AddRange(
    New Infragistics.UltraChart.Data.Series.ISeries() {seriesLine, seriesColumn}) 

    chtMainGraph.Series.DataBind()

    Thanks

    • Post Points: 20
  • 07-21-2008 17:08 In reply to

    Re: Composite Chart (Column and Line), Line Chart never appears

    yannh,

    Are you setting properties anywhere else in code?  I just copied and pasted your code snippet into a running sample and it works correctly; I get the LineChart layer to show over the ColumnChart layer.

    • Post Points: 20
  • 07-22-2008 8:49 In reply to

    • yannh
    • Top 500 Contributor
    • Joined on 02-22-2008
    • Points 315

    Re: Composite Chart (Column and Line), Line Chart never appears

    Kim,

    I don't do anything else in my code and I can't see my Line in my chart. I get the same results.

    Do you have an idea of what can be the problem?


    The version of the Librairies I use is 8.1.20081.1000


    • Post Points: 20
  • 07-23-2008 10:07 In reply to

    Re: Composite Chart (Column and Line), Line Chart never appears

    I also could not reproduce this with 8.1.20081.1000. Your line might be drawn behind the columns for whatever reason, which you can test by either setting yaxis.RangeMax to 150 or setting your column layer to be invisible. If you can see your line then, maybe it's the gradient on your columns that's causing the line to be hidden. Try pasting your code in a brand new project, as I'm certain you won't be able to reproduce the problem there, just as I was unable to do the same.


    • Post Points: 20
  • 07-23-2008 15:26 In reply to

    • yannh
    • Top 500 Contributor
    • Joined on 02-22-2008
    • Points 315

    Re: Composite Chart (Column and Line), Line Chart never appears

    Hi Max,
    I did what you told me. I created a new project with the same code but the result is still the same... I don't know what to do... Then I give you all the code I have done to obtain the wrong result. If you have an idea or anything to try, I'm wide open. Here are the only two files I have in my vb windows application.

    My Form1.vb file

    -------------------------------------------------

    Imports Infragistics

    Public Class Form1Public Sub New()

    InitializeComponent()

    Dim area1 As New Infragistics.UltraChart.Resources.Appearance.ChartArea()

    chtMainGraph.CompositeChart.ChartAreas.Add(area1)

    Dim xaxis As New Infragistics.UltraChart.Resources.Appearance.AxisItem(chtMainGraph, UltraChart.Shared.Styles.AxisNumber.X_Axis)

    xaxis.OrientationType = UltraChart.Shared.Styles.AxisNumber.X_Axis

    xaxis.DataType = UltraChart.Shared.Styles.AxisDataType.String

    xaxis.Labels.ItemFormat = UltraChart.Shared.Styles.AxisItemLabelFormat.ItemLabel

    xaxis.SetLabelAxisType = UltraChart.Core.Layers.SetLabelAxisType.GroupBySeries

    xaxis.Labels.Layout.Behavior = UltraChart.Shared.Styles.AxisLabelLayoutBehaviors.Auto

    xaxis.Labels.Orientation = UltraChart.Shared.Styles.TextOrientation.Horizontal

    Dim yaxis As New Infragistics.UltraChart.Resources.Appearance.AxisItem(chtMainGraph, UltraChart.Shared.Styles.AxisNumber.Y_Axis)

    yaxis.OrientationType = UltraChart.Shared.Styles.AxisNumber.Y2_Axis

    yaxis.DataType = UltraChart.Shared.Styles.AxisDataType.Numeric

    yaxis.Labels.ItemFormat = UltraChart.Shared.Styles.AxisItemLabelFormat.DataValue

    yaxis.SetLabelAxisType = UltraChart.Core.Layers.SetLabelAxisType.GroupBySeries

    yaxis.Labels.Layout.Behavior = UltraChart.Shared.Styles.AxisLabelLayoutBehaviors.Auto

    yaxis.Labels.Orientation = UltraChart.Shared.Styles.TextOrientation.Horizontal

    yaxis.RangeType = UltraChart.Shared.Styles.AxisRangeType.Custom

    yaxis.RangeMin = 0

    yaxis.RangeMax = 75

    Dim xaxis2 As New Infragistics.UltraChart.Resources.Appearance.AxisItem(chtMainGraph, UltraChart.Shared.Styles.AxisNumber.X_Axis)

    xaxis2.OrientationType = UltraChart.Shared.Styles.AxisNumber.X_Axis

    xaxis2.DataType = UltraChart.Shared.Styles.AxisDataType.String

    xaxis2.SetLabelAxisType = UltraChart.Core.Layers.SetLabelAxisType.ContinuousData

    Dim yaxis2 As New Infragistics.UltraChart.Resources.Appearance.AxisItem(chtMainGraph, UltraChart.Shared.Styles.AxisNumber.Y2_Axis)

    yaxis2.OrientationType = UltraChart.Shared.Styles.AxisNumber.Y_Axis

    yaxis2.DataType = UltraChart.Shared.Styles.AxisDataType.Numeric

    yaxis2.Labels.ItemFormat = UltraChart.Shared.Styles.AxisItemLabelFormat.DataValue

    yaxis2.SetLabelAxisType = UltraChart.Core.Layers.SetLabelAxisType.ContinuousData

    yaxis2.RangeType = UltraChart.Shared.Styles.AxisRangeType.Custom

    yaxis2.RangeMin = 0

    yaxis2.RangeMax = 150

    chtMainGraph.ChartType = UltraChart.Shared.Styles.ChartType.Composite

    Dim seriesColumn As New UltraChart.Resources.Appearance.NumericSeries

    Dim seriesLine As New UltraChart.Resources.Appearance.NumericSeries

    Dim appearenceColumn As New UltraChart.Resources.Appearance.ChartLayerAppearance()Dim appearenceLine As New UltraChart.Resources.Appearance.ChartLayerAppearance()

    seriesColumn.Data.DataSource = GetData()

    seriesColumn.Data.LabelColumn = "Mois"

    seriesColumn.Data.ValueColumn = "CoutVoulu"

    seriesLine.Data.DataSource = GetSecondaryData()

    seriesLine.Data.LabelColumn = "Mois2"

    seriesLine.Data.ValueColumn = "CoutVoulu2"

    appearenceColumn.ChartType = UltraChart.Shared.Styles.ChartType.ColumnChart

    appearenceColumn.ChartArea = area1

    appearenceColumn.Series.Add(seriesColumn)

    appearenceColumn.AxisX = xaxis

    appearenceColumn.AxisY = yaxis

    appearenceLine.ChartType = UltraChart.Shared.Styles.ChartType.LineChart

    appearenceLine.ChartArea = area1

    appearenceLine.Series.Add(seriesLine)

    appearenceLine.AxisX = xaxis2

    appearenceLine.AxisY = yaxis2

    chtMainGraph.CompositeChart.ChartLayers.Add(appearenceColumn)

    chtMainGraph.CompositeChart.ChartLayers.Add(appearenceLine)

    area1.Axes.Add(xaxis)

    area1.Axes.Add(yaxis)

    area1.Axes.Add(xaxis2)

    area1.Axes.Add(yaxis2)

    chtMainGraph.Series.AddRange(
    New Infragistics.UltraChart.Data.Series.ISeries() {seriesLine, seriesColumn})

    chtMainGraph.Series.DataBind()

    End Sub

     

    Public Function GetData() As System.Data.DataTable

    Dim bob As New DataTable()

    Dim rowzz As DataRow

    bob.Columns.Add("Mois", System.Type.GetType("System.String"))

    bob.Columns.Add("CoutVoulu", System.Type.GetType("System.Int32"))For i As Int32 = 1 To 10

    rowzz = bob.NewRow()

    rowzz("Mois") = MonthName(i)

    rowzz("CoutVoulu") = (i + 3) * 3

    bob.Rows.Add(rowzz)

    Next

    Return bob

    End Function

     

    Public Function GetSecondaryData() As System.Data.DataTable

    Dim bob As New DataTable()

    Dim rowzz As DataRow

    bob.Columns.Add("Mois2", System.Type.GetType("System.String"))

    bob.Columns.Add("CoutVoulu2", System.Type.GetType("System.Int32"))For i As Int32 = 1 To 10

    rowzz = bob.NewRow()

    rowzz("Mois2") = MonthName(i)

    rowzz("CoutVoulu2") = (i + 3) * -4

    bob.Rows.Add(rowzz)

    Next

    Return bob

    End Function

    End Class

     

    My Form1.Designer.vb file

    ----------------------------------------------------

    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

    Partial Class Form1

    Inherits System.Windows.Forms.Form

    <System.Diagnostics.DebuggerNonUserCode()> _

    Protected Overrides Sub Dispose(ByVal disposing As Boolean)

    Try

    If disposing AndAlso components IsNot Nothing Then

    components.Dispose()

    End If

    Finally

    MyBase.Dispose(disposing)

    End Try

    End Sub

    Private components As System.ComponentModel.IContainer

    <System.Diagnostics.DebuggerStepThrough()> _Private Sub InitializeComponent()

    Me.components = New System.ComponentModel.Container

    Me.chtMainGraph = New Infragistics.Win.UltraWinChart.UltraChart

    CType(Me.chtMainGraph, System.ComponentModel.ISupportInitialize).BeginInit()

    Me.SuspendLayout()

    Me.chtMainGraph.Location = New System.Drawing.Point(12, 12)

    Me.chtMainGraph.Name = "chtMainGraph"

    Me.chtMainGraph.Size = New System.Drawing.Size(824, 533)

    Me.chtMainGraph.TabIndex = 2

    Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)

    Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font

    Me.ClientSize = New System.Drawing.Size(848, 557)

    Me.Controls.Add(Me.chtMainGraph)

    Me.MinimumSize = New System.Drawing.Size(856, 591)

    Me.Name = "Form1"

    CType(Me.chtMainGraph, System.ComponentModel.ISupportInitialize).EndInit()

    Me.ResumeLayout(False)

    End Sub

    Private WithEvents chtMainGraph As Infragistics.Win.UltraWinChart.UltraChart

     

    End Class

     


    • Post Points: 20
  • 07-23-2008 17:04 In reply to

    Re: Composite Chart (Column and Line), Line Chart never appears

    yannh,

    I believe I found the issue- in your GetSecondaryData() function, the integer values are all negative.  You have defined both Y axes to have positive values, so you never see the negative values in your chart.  Change the integer values to be positive, and you should see the line in your chart.

    • Post Points: 20
  • 07-24-2008 8:30 In reply to

    • yannh
    • Top 500 Contributor
    • Joined on 02-22-2008
    • Points 315

    Re: Composite Chart (Column and Line), Line Chart never appears

     

    It works, thank you, but at the begining, the value was not negative. I changed the values when I tried different ways to get my line on my chart. So you were right on your first post. Thank you Kim, I'm sorry for my mistake.
    • Post Points: 5
Page 1 of 1 (10 items)
Powered by Community Server (Commercial Edition), by Telligent Systems