Hello
I am trying to create custom control with Grid and below XamDataChart, bars should be under the corresponding column.
The problem is. I would like to move NumericYAxis outside of XamDataChart control. and put it in FreezeArea.So Labels should be visible despite of scroll position, Scroll should affect only bars.
Could you advice?
Hi Petr,
This thread seems to have slipped through the cracks. But you did create a private support case for this same issue and I had sent you some information about that. I'll include that information here as well in case someone else is looking for something similar.
"For that you should probably just use two XamDataCharts side by side. Both charts should be bound to the same data but in the left chart, set the series Visibility to collapsed and set the X axis LabelSettings.Visibility to collapsed as well. This should leave the Y axis as the only thing visible in that chart. Then you can put the left chart in the freeze area.
For the right side chart, set the Y axis LabelSettings.Visibility to collapsed so the Y axis labels do not render and leave the X axis and series visible. This should give you the effect you are looking for.
I would like to mention that your current approach is ok if you don't have that many columns but for large data sets you may run into performance issues because the chart is unable to virtualize its elements properly. This is due to being inside of a ScrollViewer as it appears to be in your screenshot. Just something to be wary of."
Hi,
I am trying to do a similar thing.
Its not overly efficient to render two charts, one is heavy enough.
I have also tried the solution you have offered and that doesn't appear to work. These are the problems I see:
* The left chart is scaled, so the axis doesn't line up
* The act of collapsing the x axis label settings visibility results in the entire x axis disappearing, which causes the y axis to "drop down" and not line up with the graph on the right.
* The act of collapsing the series visibility, results in loads of lines and white space left in its space.
* Collapsing the right side y axis, doesn't seem to actually collapse it, just hides it, so we are left with a large gap between the two charts.
Did this solution work for you? Perhaps you could share that code?
Thanks.
Hi David,
Rendering two charts should be fine since the first chart representing the Y axis isn't actually rendering a series. You actually don't even need to create a series in there like I had suggested before. Just create a XamDataChart with a NumericYAxis and set the MinimumValue and MaximumValue to match the Y axis range in the second chart. Also set the PlotAreaMinWidth property to 0.
<ig:XamDataChart PlotAreaMinWidth="0"> <ig:XamDataChart.Axes> <ig:NumericYAxis x:Name="yAxisFreezeArea" MinimumValue="{Binding ElementName=yAxisScrollingArea, Path=ActualMinimumValue}" MaximumValue="{Binding ElementName=yAxisScrollingArea, Path=ActualMaximumValue}"/> <ig:NumericXAxis x:Name="xAxisFreezeArea"/> </ig:XamDataChart.Axes></ig:XamDataChart>
You can see that I have a NumericXAxis in there. This gives the necessary spacing at the bottom of this chart so the Y axis will line up with the second chart. If you want perfect alignment then your X axis should be synchronized with your second chart X axis as much as possible. In this case you may need to provide a hidden series to the above chart, but for a basic chart this may be enough.
I'm going to address your points below:
- Not sure what you mean by scaled. If you are referring to the Y axis range then it's required to manually set the minimum and maximum value to match the range on the second chart that is rendering. You can use an ElementName binding like above.
- If you use the above XAML you don't actually need to provide a series in order to get the spacing right. With no series, the X axis can't calculate a range so it is left empty.
- This is why I set PlotAreaMinWidth to 0. Not sure if it applies in your case but in my sample it works.
- Are you setting the Visibility property on the Y axis itself or in the LabelSettings? If you set it on the axis itself the chart still allocates space for it. The Visibility property inside LabelSettings is the one you want to set to Collapsed.
I didn't have a sample from when I helped the original poster, I just gave some ideas and hadn't heard back from him. I did, however, throw together a very simple example which I have attached.
Thanks for the response.
The y axis is out on that and even more so when the scrollbar is shown.
Would it be difficult to build this into the product?
Thanks,
David
You can submit this as a product idea here: http://ideas.infragistics.com. I can't answer as to how difficult it would be to build into the product.
How far out are we talking about? When I ran this sample locally, even with the scrollbar visible it wasn't that far from the chart. Maybe a 10 or so pixels. This is down to margins and such that exist inside the chart. You can try offsetting this by adding margin to both the left and right chart pushing them closer together.
Hi Rob,
I pasted an image in the above reply to illustrate the issue, although it doesn't seem to display (it did when I created it).
That aside, yes, its out by a few pixels, which is fairly critical when someone is performing an important task off the back of the numbers they are reading!
The solution is not one that I would feel comfortable including in production software, since it feels somewhat hacky. If you (Infragistics) were to change the internal margins of the grid at some point, the upgrader would need to somehow know to revisit this code (the reality is, it would likely be missed).
I would also have to dig around in the visual tree to work out if the horizontal scrollbar is shown or not and offset the left axis by its height.
If I provide an idea, what are the timescales to getting this implemented?
I shall investigate whether any other chart providers support it, or write my own.
Kind Regards,
Generally it depends on how many votes the idea gets but we don't add new features to components mid release right now. We just released 16.2 so new features won't show up till 17.1 and we have already planned our 17.1 release. So it's safe to say that any new ideas added now won't be considered until after 17.1 is released which is sometime around March or April.