WPF SciCharts Stacked Column Side by Side Spacing - wpf

I've noticed a weird issue with SciCharts on WPF and am trying to understand if the issue is something within our control or not.
I'm noticing, in particular, that the spacing between Stacked Column Series groupings is weird. If you load up the SciCharts v.4.x Example and look at the "Stacked Column Side By Side" example, you can see this. Simply go from having everything checked to unchecking "China." Every single other bar (despite that China is no longer selected, freeing up more margin around the groups) is now narrower, even though there is more space to occupy.
In my own usage, I have noticed that the spacing gets VERY unusual, despite the fact that nothing can be turned on/off. There are data points for everything and there is still a large gap, despite setting Spacing to Relative and 0.01 and the DataPointWidth to 1.0.
I haven't checked the v.5.x examples yet, but I know that the issue is showing up with our usage of 5.2.1.x assemblies.
Is there any other way of expanding or overriding spacing between groups? It gets terribly sad when we are showing 9 groupings (18 bars; 2 data points for each group, so 9 categories or groupings) and we have more whitespace around the bar groupings than the width of the bars themselves.
Thank you!

First thing I would suggest is to update. The latest official release is SciChart WPF v5.4 and SciChart WPF v6 is in BETA now to be released soon.
We have fixed hundreds of bugs over the years and Stacked Column spacing has come up several times.
In the latest version, there are properties to control Stacked Column spacing. You will need to check
StackedColumnRenderableSeries.UseUniformWidth: where true forces all columns to have the same width
StackedColumnRenderableSeries.DataPointWidth: where 0.0 - 1.0 controls the gap width
Finally, Stacked Column series require that all DataSeries have the same number of points.

Related

SciChart annotation that is on the axis and above with "normal" paning behavior

I have a situation in which I have a chart annotation that represents an event that happened. I want to add a marker that consists of several icons in the middle of it (see 1 and 2):
I tried the axismarkerannotation but it has a weird behavior of snapping its middle point and when it is paning out of range it disappears.
I saw there is the possibility to place an annotation on the ModifierSurface but couldn't find an example.
I will fiddle around with this approach but perhaps someone has an solution for this? I want both markers to be visible and not when the potin in between 1 and 2 is out of sight both dissapear...
Is treating both icons as seperate annotations the only viable solution?

WinForms chart zooming X-axis labels temporarily disappear when zooming

I have a chart which looks like this:
When I zoom into a section, the labels disappear:
However, I can get the labels back by scrolling all the way to the right and releasing the mouse:
And then when I scroll back to the left, the labels are all visible:
This behaviour is just super weird am I'm completely dumbfounded as to what would cause this, or even how to debug.
Does anyone have any ideas on what I could try to fix this? I'd like the labels to be shown as in the last image, but when first zooming.
It looks like others have had similar issues, so I'm going to try combining several answers I found online to maybe help fix your issue.
John (DevExpress Support) says:
It appears that the AutoLayout feature leads to this issue. Please set the ChartControl.AutoLayout property to False. This should make axis label elements visible.
https://www.devexpress.com/Support/Center/Question/Details/T328948/x-axis-labels-disappear-in-chartcontrol
Valdemar (DevExpress Support) says:
I suggest that you use the Axis2D.ResolveOverlappingOptions properties. Set AllowHide to False:
[XAML]
<dxc:XYDiagram2D.AxisX>
<dxc:AxisX2D >
<dxc:AxisX2D.Label>
<dxc:AxisLabel>
<dxc:Axis2D.ResolveOverlappingOptions>
<dxc:AxisLabelResolveOverlappingOptions AllowRotate="True" AllowStagger="True" AllowHide="False" />
</dxc:Axis2D.ResolveOverlappingOptions>
</dxc:AxisLabel>
</dxc:AxisX2D.Label>
</dxc:AxisX2D>
</dxc:XYDiagram2D.AxisX>
https://www.devexpress.com/Support/Center/Question/Details/Q489042/chart-axis-labels-disappearing-when-chart-is-resized
SharpStatistics says:
The only way I could replicate the problem you describe is by setting the x axis Label.style interval to a specific value, say,
area1.AxisX.LabelStyle.Interval = 100;
and then when I zoom in on the chart if the zoomed x axis section is less than 100 I don't see any lables.
loi-se (the OP) replies:
Thanks for your suggestion! But as far as i know i don't set the xaxis labelstyle anywhere, i just use: Chartarea1.AxisX.IntervalAutoMode = IntervalAutoMode.VariableCount
This works fine in the case of the yaxis but the xaxis seems to behave on its own will. Maybe i should renew my .net framework installation and get the latest version of the chart component? Any other suggestions?
https://social.msdn.microsoft.com/Forums/vstudio/en-US/d345d4a3-a4be-4b41-9c83-9a9d9dbb69b9/the-labels-of-the-xaxis-are-disappearing-when-i-zoom-in?forum=MSWinWebChart
This one is for SSRS reports, but I'm assuming it uses the same (or similar library) and supports the link right above this one.
When designing an SSRS Report using Chart you may notice that some of the labels whether in X or Y axis are not being displayed, this is because it’s so smart that it detects what you actually want (not!).
To display all labels follow the steps below:
Right click either the X or Y axis, Click Properties:
Set the Interval to 1:
Viola!
https://randypaulo.com/2012/02/20/ssrs-chart-label-missing-xy-axis-missing/
That's about all I can find that are similar, without spending a bunch more time researching this. Hopefully something here helped!

WPF Speed Load Time of Expanding a Specific TreeView Element

I have been trying to find out specific ways of improving the load times of a treeview element that contains 1500 flat nodes. At the moment it takes over 15 seconds to expand a single node.
I have tried the suggestions regarding virtualisation but its my understanding that virtualisation basically avoids loading and rendering elements that cannot be seen. Correct?
If so, what happens when you expand an element where there are 1500 items within that single expansion, does it not then need to load those 1500 items?
It seems obviously, if I split up my TreeView so that each time 10 elements were added, it added another folder. So you couldn't view the whole treeview at once. This is NOT really an option for me.
So is there a way of possibly background loading the tree element add, so that I can display the treeview even while its loading items?
This is the only solution I can think of but I have yet to come across a way of being able to update the UI and not be blocking at the same time.
Thanks
Virtualization is the logical way to go.
Math is your friend here:
Let's, for the sake of argument, assume that 1 node takes up an insanely small 5 vertical pixels. A screen with a height of 7500 pixels would be able to show all 1500 nodes.
Cutting the number in half to 750 nodes would still require a height of 3750 pixels.
If we take a more reasonable height for one node, I think the default is 19, a decent 4K monitor would be able to show around 200 of them.
I'm currently running on a 1920x1200 monitor, with scaling at 100% (strangely called "smaller"). Explorer, with the ribbon collapsed, shows me 43 items. 2000 pixels would give me around 73 items in view. And the items in Explorer are pretty much as small as I would want them to be without going blind.
Bottom line: You're unlikely to run in to the problems with virtualization.
For anybody coming across this question. Ensure you haven't wrapped (or even have a scrollviewer) in the same grid as your treeview.
It completely disables virtualisation without warning.

Control snapping in Visual Studio 2010

I'm sort-of just nit picking here, but maybe there's a simple solution which will save me some time.
When I'm drawing my Winforms GUI in the designer, controls snap to certain points. I can align the baseline of the text of one control to that of another, I can align the left and/or top of one control to another, etc. This is all great.
What's great too, is that the controls snap to other controls spaced with their margins. This means that if I'm making a vertical array of TextBoxes, then I can have them equidistant in my GUI - it looks less messy.
However not everything snaps correctly, or at all. Say I have put in my TextBoxes and now I wish to reduce the width of my form so that there is no white space between the edges of the TextBoxes and the edge of the form. Additionally, I want the distance between the edge of the TextBoxes and the edge of the Form to be the same on the left as it is on the right. If I drag the right edge of the form to the left, towards the TextBoxes it will not snap. I'm left with either calculations to work out what the width should be, or a juggling act to gradually reduce the width until the TextBox is snapping to both the left of the right.
I'm not saying this process is particularly difficult or time consuming. It's just that if it were to snap, the whole process would be infinitely easier.
Is there a built-in option in VS2010, or perhaps an extension? Or maybe I'm just doing it wrong in the first place?
The snap lines in the designer work perfectly when moving or resizing any of the built-in controls. The only time that they don't work is when you are resizing the form itself.
I agree that it would be extremely convenient to have snap lines here, as well. I wish I knew of a way to enable this. But unfortunately, I don't believe that there is one.
The workarounds are either to calculate the proper size mathematically, or guess at resizing the form then check your work by dragging one of the controls (and using the snap lines that appear). I go through the same "juggling act" that you describe on an unfortunately regular basis.
Whenever a control needs to be positioned so that it "snaps" to a form edge I usually move (or resize) the controls to the correct size first, and then change the controls "Anchor" property of those controls to be anchored to the corresponding form edge (even if the form itself won't be allowed to resize).
That way whenever I resize the form, the controls position relative to that form remains the same, simply resizing or moving the control as required (depending on the Anchor property chosen).
I completely agree that the ability to "snap" the form to controls when resizing the form would be extremely useful, but its normally possible to work-around using the anchor property in this way - the times when its doesn't work (such as when a form consists entirely of a column of text-boxes is a fixed height), I'm afraid you need to resort to calculations, but I find that most of my dialogs are resizable.

Why don't my scrollbars work properly when programmatically hiding rows in silverlight Datagrid?

I have a Silverlight datagrid with custom code that allows for +/- buttons on the lefthand side and can display a table with a tree structure. The +/- buttons are bound to a IsExpanded property on my ViewModelRows, as I call them. The visibility of rows is bound to an IsVisible property on the ViewModelRows which is determined based on whether or not all of the parent rows are expanded. Straightforward enough.
This code works fine in that if I scroll up and down the grid with PageUp/PageDown or the arrow keys, all the right rows are hidden and everything has the right structure and I can play with the +/- buttons to my hearts content. However, the vertical scroll bar on the right hand side, although it starts off the correct size and it scrolls through the rows smoothly, when I collapse rows and then re-expand them, doesn't go back to its correct size. The scrollbar can still usually be moved around to scroll through the whole collection, but because it is too big, once the bar moves to the bottom, there are still more rows to go through and it sort of jerkily shoots all the way down to the bottom or sometimes fails to scroll at all. This is pretty hard to describe so I included a screenshot with the black lines drawn on to show the difference in scrollbar length even though the two grids have the same number of rows expanded.
I think this might be a bug related to the way the Datagrid does virtualization of rows. It seems to me like it isn't properly keeping track of how tall each row is supposed to be when expansion states change. Is there a way to programmatically "poke" (read hack) it to recalculate its scrollbar size on LoadingRow or something ugly like that? I'd include a code sample but there's 2 c# files and 1 xaml file so I wanted to see if anyone else has heard of this sort of issue before I try to make it reproducible in a self-contained way. Once again, scrolling with the arrow keys works fine so I'm pretty sure the underlying logic and binding is working, there's just some issue with the row height not being calculated properly.
Since I'm a new user, it won't let me use image tags so here's the link to a picture of the problem:
http://img210.imageshack.us/img210/8760/messedupscrollbars.png
This is a known issue according to what I read today (and is apparently still an issue in the as-yet-unreleased Silverlight 4):
http://forums.silverlight.net/forums/p/153997/343790.aspx

Resources