Negative values on the ClusteredColumnChart

Sep 7, 2015 at 7:41 PM
First of all, thank you very much for the initiative of keep the project alive.

I'm trying to use the ClusteredColumnChart with negative values (like the print screen at the home page), and the bars stay always at 0 when the value is negative.

Followin is my piece of XAML code:
                     <chart:ClusteredColumnChart >
                            <chart:ChartSeries DisplayMember="Name"
                                   ItemsSource="{Binding Path=Items}"
                                   SeriesTitle="{DynamicResource costs}"
Thanks in advance.
Sep 8, 2015 at 9:54 AM
Its a great library, but it didn't quite have all I needed for my project so I thought I'd try to understand it and change it. Then figured I may as well put it back up so others could use the changes if it was helpful. I'm still trying to figure bits of it out!

Without seeing all your code its hard to tell, but I have a few 'blind' suggestions.
  • Which version are you using. I have two releases but only release 2 has the negative value support. (this is the nice easy solution!)
  • I dont see the Style="{StaticResource MinimalChartStyle}" or similar in the <chart:ClusteredColumnChart> line. This shouldn't cause the error - more likely it would just appear blank!
  • Are you seeing grid lines both positive and negative, with the labels you expect?
    When I try the attributes in the order you have I see the axis but no marks,or grid titles. I usually use the order as below
SeriesTitle="{Binding scatterData.seriesDisplayName}"
                        ItemsSource="{Binding scatterData.Items}"
  • If you have both positive and negative values in your chart, and are only seeing the positive grid lines, then it seems to me that you may have the old code from Torsten, and perhaps the new code from me in the same project and are calling the wrong one?
  • Try looking at the Output window from a debug build and see if you have any binding issues?
If you cant figure it out, you could send through a screen shot of the graph with the data that should be shown and I'll try to duplicate it here. Provided its not too massive of course...
Marked as answer by bento_85 on 9/8/2015 at 6:49 AM
Sep 8, 2015 at 2:40 PM
Thank you very much.

I was trying to execute my sample direct on the source code project.

It worked when I used the updated dll, but there is still a small issue.

The positive numbers on the Y axis are showed by the half (picture above):


Maybe is missing some configuration?

Thanks in advance.
Sep 8, 2015 at 8:19 PM
The issue with the numbers should go away if the graph is made slightly bigger (in this case). You can see in the negative numbers (which only go to 3) are OK.

There is a small bug in the sizing code in release 2 (which I have fixed in 3 but not quite finished yet, or tested) - if you look at the gaps between the grid lines they are different between the positive and negative values. There will always be some issues with small graphs and the gaps being not big enough to hold the numbers, but I guess there are solutions of skipping every second grid line for example. If it is a big issue, could you put it in the issues log so I can keep track of it and I'll try to prioritse it.

In the meantime I have put up a new alpha release of release 3. Dont use it for line/scatter charts as it wont work yet. But if you would like to use it for the chart you have and compare it against the existing one that would be great for me for 'real life testing'. It has the same namespace as the other chart so you wont be able to have both versions running at once.

If it works, and you need both the line/scatter and the column chart working in the same project let me know and I can probably do a temporary fix with the old line/scatter code in it.

Also, can you let me know if you do / dont download it so I can hide it from others to stop any confusion!

Sep 8, 2015 at 9:48 PM
Edited Sep 8, 2015 at 11:05 PM
Hi, I've got this alpha release 3, and I'm using just bar charts.

I made a new test and the issue with the positive numbers was solved in this release.

About the gaps, it seems that the same space is considered in both positive and negative Y axis, and the gaps on the side that has the biggest value has smaller gaps.

I've made the chart bigger, but this behavior still happens, so columns that should have the same size (like 3 and -3 at the images above) have different sizes.

Let me know if you have some idea to workaround this issue, or there is something else that I can make to help.

Thank you!
Sep 9, 2015 at 10:02 AM
Sorry, but I cant seem to replicate this problem. Whenever I use exactly the same values it seems to show just fine. I tried release 1 with your values and got exactly what you described in your first post (positive values, and just the -ve numbers with no bars), so I am guessing you were using the first release.

One thing you could try is doing a clean build, or even removing the dll and building without one (which should fail) and then putting the new one in, just to make sure its using the correct dll. When I tested it, it would sometimes cache the dll and use the old one - it cant have realised anything had changed.

Or even try the project code for release 2?

What operating system are you using? I am on Win 7 here, with .Net 4.5, VS2013. I haven't tried it on 8 as yet. The code looks at a WPF grid and sets the size to x* and y*, based on the numbers you see on the axis. At one stage it was using the min and max absolute values (as in the original code) which gave a similar result to what you are seeing. Its as if it cant find the grid and isnt updating it - but when this happened in testing it crashes horribly and doesnt do anything!

Sorry I can help more at present - Ill try to get more code up soon, and see if it helps. I'm working on the line / scatter and a combination line/scatter/column chart.

Let me know if you have any other ideas / questions / improvements. Ill try to help you get this going - its one of those frustrating things when it works here and you expect it will work elsewhere..

P.S I like the colour scheme youv'e got there, a bit bolder than the original.
Sep 9, 2015 at 11:25 AM

I am on Win 7 with .Net 4.5 and VS2015.

I've tried clean, remove and try again with the other dll versions, but the result was the same.

It works fine just when I put the same biggest value as positive and negative (in the sample, 4 and -4), than it seems to create equal gaps in both positive and negative sides.

I'll try some more tests and I'll keep you informed if I have some news.

Thank you.