none
Bar Series Gap in Column Chart (VB.NET)

    Question

  • Hello,

    i would like to ask is there any way to remove the particular bar series from the chart at some point which data is equal zero ?

    because i want to remove the gap between two series when the middle series value is zero

    I also attached the picture of my result.

    Wednesday, April 05, 2017 3:33 PM

All replies

  • Hi ChayS3000,

    If you're using "System.Windows.Forms.DataVisualization.Charting", try like this:
    For Each series In Chart1.Series
    	' Set empty points visual appearance attributes
    	series.EmptyPointStyle.Color = Color.Gray
    	series.EmptyPointStyle.BorderWidth = 1
    	series.EmptyPointStyle.BorderDashStyle = ChartDashStyle.Dot
    	series.EmptyPointStyle.MarkerSize = 4
    	series.EmptyPointStyle.MarkerStyle = MarkerStyle.Diamond
    	series.EmptyPointStyle.MarkerBorderColor = Color.Gray
    	series.EmptyPointStyle.MarkerColor = Color.LightGray
    Next
    I hope this would be helpful and you will get good result.

    Regards,
    Ashidacchi
    Thursday, April 06, 2017 5:38 AM
  • Hi Chay S3000,

    According to your description and screenshot, you want to remove the bar series from the chart when the data is equal zero. I sorry to tell you that you may not do this, but you can try this method to achieve your propose.

    For Each cs As Series In Chart1.Series
                Chart1.DataManipulator.Filter(DataVisualization.Charting.CompareMethod.EqualTo, 0, cs)   'Compare if equal to zero
                cs.ChartType = SeriesChartType.StackedColumn
            Next
    

    Screenshot:

    Best Regards,

    Cherry Bu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, April 06, 2017 5:40 AM
    Moderator