scrolling clustered bar series slow

Posted by: ginacresse on 8 September 2017, 2:45 pm EST

  • Posted 8 September 2017, 2:45 pm EST

    I'm using the following code to build a clusterd bar chart.  The chart displays fine except that I cannot get the legend to show up.  Also, this chart is very slow to scroll up and down, unlike the non-clustered charts I've created.  Am I doing something wrong? 


    Private Sub ChartEmptyVsNonEmpty(ByVal DS As Data.DataSet)


    Dim series1 As New FarPoint.Win.Chart.BarSeries


    Dim series2 As New FarPoint.Win.Chart.BarSeries(series1)


    Dim series As New FarPoint.Win.Chart.ClusteredBarSeries()


    Dim label As New FarPoint.Win.Chart.LabelArea()


    Dim model As New FarPoint.Win.Chart.ChartModel()


    Dim plotArea As New FarPoint.Win.Chart.YPlotArea()


    Dim ChartHeight As Integer


    Dim legend As New FarPoint.Win.Chart.LegendArea()


    legend.Location = New PointF(0.98F, 0.5F)


    legend.AlignmentX = 1.0F


    legend.AlignmentY = 0.5F


    label.Text = "Empty / Non-Empty Tanks by Size Family"


    label.Location = New PointF(0.5F, 0.02F)


    label.AlignmentX = 0.9F


    label.AlignmentY = 0.0F


    series1.Values.DataSource = DS.Tables(5)


    series1.Values.DataField = DS.Tables(5).Columns(1).ColumnName


    series1.CategoryNames.DataSource = DS.Tables(5)


    series1.CategoryNames.DataField = DS.Tables(5).Columns(0).ColumnName


    series1.LabelNumberFormat = "#,##0"


    series1.LabelVisible = True


    series2.Values.DataSource = DS.Tables(5)


    series2.Values.DataField = DS.Tables(5).Columns(2).ColumnName


    series2.CategoryNames.DataSource = DS.Tables(5)


    series2.CategoryNames.DataField = DS.Tables(5).Columns(0).ColumnName


    series2.LabelNumberFormat = "#,##0"


    series2.LabelVisible = True


    series.Series.Add(series1)


    series.Series.Add(series2)


    plotArea.Location = New PointF(0.1, 0.05F)


    plotArea.Size = New SizeF(0.6F, 0.6F)


    plotArea.Series.Add(series)


    plotArea.Vertical = False


    model.LabelAreas.Add(label)


    model.PlotAreas.Add(plotArea)


    fpsEmptyNonEmpty.ActiveSheet.ColumnHeader.Visible = False


    fpsEmptyNonEmpty.ActiveSheet.RowHeader.Visible = False


    fpsEmptyNonEmpty.ActiveSheet.PrintInfo.UseMax = False


    ChartHeight = DS.Tables(5).Rows.Count * 50


    fpsEmptyNonEmpty_Sheet1_SpreadChart1.Size = New Size(1000, ChartHeight)


    fpsEmptyNonEmpty_Sheet1_SpreadChart1.Model = model


    End Sub


     


    I discovered I needed to add model.LegendAreas.Add(legend)
    but I the legend only consists of 2 colored boxes but no words.  How do I get the text to display?

  • Replied 8 September 2017, 2:45 pm EST

    Hello,

    The above code working fine to show up the legend text. Please make sure that you have not changed the "TextFill" property for the legends anywhere. Also I have a clustered chart series which is as high as screen and I did not see any scrolling issue as well. I am using Spread 6 for Windows forms. 

    Could you please post a small sample application for us to debug?

     

    Thanks,

     

  • Replied 8 September 2017, 2:45 pm EST

    I discovered that the sluggishness while scrolling was caused by null values in my dataset, so I will address that with SQL. The missing text on the legend is still an issue as you can see in the attached project.
    2011/09/WindowsApplication1.zip
  • Replied 8 September 2017, 2:45 pm EST

    Hello,

    In your code you have not given any name to the series this is why legend shows no text for series name. I added following line of code and it worked fine.

    series1.SeriesName="series1"

    series2.SeriesName="series2"

     I hope it will help you.

     

    Thanks,

     

  • Replied 8 September 2017, 2:45 pm EST

    That was it! Thanks Big Smile
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels