Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2085
Width of ColumnSeries on XamDataChart with CategoryDateTimeXAxis
posted

I am trying to display a ColumnSeries with a LineSeries on a CategoryDateTimeXAxis-based XamDataChart.  The ColumnSeries data points are meant to indicate an event and intensity value at a certain point in time, but when rendered, the ColumnSeries element widths expand to fill the screen which makes it impossible to see the time it occurred.  How can I create a ColumnSeries (or other) that will draw a fixed-width bar (say 5 pixels) at a specific date/time on a CategoryDateTimeXAxis and not expand to fill the entire width of the graph?

I have tried Gap, Width and Thickness, but none of these work well with a CategoryDateTimeXAxis-based chart.

Parents
  • 34510
    Verified Answer
    Offline posted

    Hi Gary,

    The ColumnSeries has no property that will allow you to control the width of the columns.  This width is entirely controlled by the series rendering code and it's designed to fill the space evenly between all columns.  For CategoryDateTimeXAxis this is a little different as the columns can be spaced unevenly across a date range.

    With that being said, there's nothing stopping you from grabbing the Rectangle objects and adjusting their widths after the series has rendered itself.  There is an event called RefreshCompleted which fires after the chart has rendered.  You can go through the ColumnSeries.RootCanvas and grab the Rectangles, then adjust their widths to your desired amount.  You will also need to change their position since their current position is determined by the width that the series thinks the column has.  This is done by adjusting the RenderTransform of the Rectangle.  It uses a TranslateTransform to position the columns.

    Take a look at my attached sample.  If you'd like to see this feature built into the product by default I recommend that you submit this as a product idea here: http://ideas.infragistics.com

    ControlColumnWidth.zip
Reply Children
No Data