locked
How to create column chart with fixed bar width RRS feed

  • Question

  • I am using Microsoft Charting Controls for .NET 3.5 (System.Windows.Forms.DataVisualization.Charting). When I draw column chart, the width of the column bar is keep changing depends on the number of points. I tried with the following code to keep the width fixed.

    chart1.Series["Series1"]["PointWidth"] = 0.6

    This is also not helping me to fix the issue. The above line makes more gaps between the column bar. Is there a way to keep the column bar width and gap between columns are fixed.

    Thanks,
    Kumaravel
    Friday, May 15, 2009 1:53 AM

Answers

  • the width of the data point is calculated so that the all the data points are displayed within the available space for the chart area. To control the size of the chart area you can use the change thwe Position/InnerPlotPosition properties of the chart area, together with controling the number of data point to show you could control the width of the data point

    [PointWidth] is used to control the the gaps between the data points. i.e 1 means no gap
    Thursday, May 21, 2009 8:27 PM

All replies

  • the width of the data point is calculated so that the all the data points are displayed within the available space for the chart area. To control the size of the chart area you can use the change thwe Position/InnerPlotPosition properties of the chart area, together with controling the number of data point to show you could control the width of the data point

    [PointWidth] is used to control the the gaps between the data points. i.e 1 means no gap
    Thursday, May 21, 2009 8:27 PM
  • Were you able to find a way to achieve this? I've been unsuccessfully tryin to fix the column width. Any new ideas??

    Friday, August 14, 2009 9:11 PM
  • If you want fixed width of the column bar you can keep scroll bar so that even the number of points are increased the width is going to be fixed. You can aceive it by using
    Chart1.ChartAreas("ChartArea1").AxisX.ScrollBar.Enabled = True
    
    Chart1.ChartAreas("ChartArea1").AxisX.IsLabelAutoFit = True
    
    Chart1.ChartAreas("ChartArea1").AxisX.ScaleView.Size = 20
    
    

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Monday, August 17, 2009 7:15 AM
  • I have the same problem. I have just 2 columns. the width of the columns is too big. Any suggestions regarding this
    Thursday, November 19, 2009 7:35 PM
  • Hi Sravani

    this is an old thread that has been marked as answered.

    Please post a new thread


    Thnaks :)
    Friday, November 20, 2009 7:59 AM
    Moderator
  • ohh ok jwavila. Any ways i found the solution for this. I just changed the point width. That solved my problem

    Thank u very much
    Friday, November 20, 2009 3:26 PM
  • chart1.Series["Series1"]["PixelPointWidth"] = "5";
    Wednesday, September 29, 2010 1:22 PM
  • thanks this works .....
    • Proposed as answer by Sandeep Mhatre Friday, April 20, 2012 6:18 AM
    • Unproposed as answer by siplaModerator Friday, April 20, 2012 10:57 AM
    Friday, April 20, 2012 6:16 AM