0

I am using VISI Fire in Silverlight and C# to produce some data charts. One style of chart allows stacked data to be displayed in colums the xaml code I am using looks like this:

IMG]https://i67.photobucket.com/albums/h292/Athono/xaml.png[/IMG

The chart i am trying to build is based on a visi fire chart example. if you go to http://www.visifire.com/silverlight_wpf_charts_gauges_gallery.php and look at their stacked examples here http://www.visifire.com/silverlight_stacked_charts_gallery.php you can see the xaml example I am trying to emulate.

IMG]https://i67.photobucket.com/albums/h292/Athono/post_this.png[/IMG

But my chart comes out differently. mine has this odd overlaping date feature

IMG]http://i67.photobucket.com/albums/h292/Athono/badrepresentation.png[/IMG

Now, I have carefully stepped through the code and as far as I can tell, I have the same date for each data set pair.

IMG]http://i67.photobucket.com/albums/h292/Athono/code-1.png[/IMG

I have stepped through this code and I have made sure that with each value for i, the years and the months for each data pair are exactly the same. So why is my graph so messed up?

Is there something wrong with they way I am using the DateTime class?

new DateTime((Int32) Year_Id,(Int32) SMonth_Id, (Int32)1);
Community
  • 1
  • 1
xarzu
  • 8,657
  • 40
  • 108
  • 160
  • 4
    You should remove the code screenshots and paste the actual code in your question. SO has auto syntax hilighting, so it won't look any uglier. It makes it much easier for someone to paste the code in an editor to try to repro and solve your problem. It also makes it much more searchable for people who have the same problem in the future. – Merlyn Morgan-Graham Jul 20 '11 at 03:33
  • OK. Next time I will be sure to. – xarzu Jul 20 '11 at 20:09
  • You still have the code? Just edit your question... – Merlyn Morgan-Graham Jul 20 '11 at 21:10

2 Answers2

1

1st Solution:

Set AxisXLabel property instead of XValue in both DataSeries as String. Do not set XValueType in DataSeries or in x-axis. Also do not set Interval property in x-axis.

Example:

<vc:Chart.Series>
    <vc:DataSeries>
        <vc:DataSeries.DataPoints>
            <vc:DataPoint  AxisXLabel="Jan - 2010" YValue="2"/>
            <vc:DataPoint  AxisXLabel="Feb - 2010" YValue="3"/>
            <vc:DataPoint  AxisXLabel="Mar - 2010" YValue="4"/>
        </vc:DataSeries.DataPoints>
    </vc:DataSeries>
    <vc:DataSeries>
        <vc:DataSeries.DataPoints>
            <vc:DataPoint  AxisXLabel="Jan - 2010" YValue="10"/>
            <vc:DataPoint  AxisXLabel="Feb - 2010" YValue="20"/>
            <vc:DataPoint  AxisXLabel="Mar - 2010" YValue="30"/>
        </vc:DataSeries.DataPoints>
    </vc:DataSeries>
</vc:Chart.Series>

2nd Solution:

No need to do any changes in your current code. Continue setting XValue as you are setting currently. You just need to set two properties IntervalType="Month" and Interval="1" in x-axis in XAML.

Somnath
  • 3,247
  • 4
  • 28
  • 42
0

2nd solution from Somnath works.

I am not sure about the 1st. I remember it was tried and I did not have good results. For a stacked chart, it had issues.

I got it working finally. I had to add some specification to the xaml.

Here is the fix:

<vc:Chart.AxesX>
    <vc:Axis ValueFormatString="MMM - yyyy" Padding="4" LineThickness="0" IntervalType="Months"  Interval="1"/>
</vc:Chart.AxesX>
xarzu
  • 8,657
  • 40
  • 108
  • 160