Jump to content
Software FX Community

Equivalent of AxisX.PixPerUnit, other than SetScrollView?


Recommended Posts

In pre-WPF versions of ChartFX, there was the ability to hardcode the PixPerUnit value for the X axis so that when the chart is resized to be smaller, the number of points displayed will be constant until there are too many points to display at the current PixPerUnit value.

In ChartFX for WPF, the PixPerUnit property seems to have been removed, so the only option is to use SetScrollView. The problem is that SetScrollView always sets the PixPerUnit based on the current size of the chart. So for example, if the chart is very large and there are only 2 points displayed, the points will be huge on the screen. This is fine, except that when the chart is made smaller, the points will remain huge and a scrollbar will appear with only one point displayed.

Is there any way to preserve the old behaviour, i.e. that the points will get smaller until there are too many to display at the current PixPerUnit, and only then will the scrollbar appear? The only solution I've found is to call SetScrollView from the chart's SizeChanged event, and this is definitely not ideal.

Thanks in advance.

Link to comment
Share on other sites

  • 2 weeks later...

Using version 3439 - AxisX.PixelsPerUnit works when you first set it (either through XAML or through Code) but if you change the data (either by assigning a new binding source or changing the existing one) it crashes with the error: "'Infinity' is not a valid value for property 'LargeChange'."

This seems to happen mostly when there is a scrollbar showing on the X axis, but sometimes even when there's not.

I've tried putting "AxisX.SetScrollView(0,0)" before changing the data, it still doesn't work.

Any ideas?

Link to comment
Share on other sites

It looks like the above bug also happens when you use SetScrollView(). If you have a chart that does not have a scroll bar with the current ScrollView, then you change the data so that it needs a scrollbar (by adding more points) and call .Refresh(), it crashes with the error: "'Infinity' is not a valid value for property 'LargeChange'."

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...