Jump to content
Software FX Community

Explicit example needed C# coded chart


Recommended Posts

I could use an explicit example of setting up a new Ribbon (3d) chart in C#. We are wanting to use it on a rotating square which doesn't lend to doing it in the xaml very easily. Can someone please show me how to set up a line(ribbon) graph programatically with the data being passed in? I also need to see how to label the x-axis with date values in this manner.

 So as to be specific, lets say the following is the data I wish to map

X values ('09/01/2007', '10/01/2007','11/15/2007','01/07/2008','05/14/2008') which I have immediately available as an array of strings.

corresponding Y values is an array of integers (13,16,14,17,19) for one ribbon

and Y values (15,15,16,14,14) for second ribbon.

If possible show me how to populate these ribbons and do a  decent 3d transform that will show them off well.


For extra credit, It would be cool to see how to link this same example to a Microsoft CE db just by passing values from two fields (date and the int) directly from a table. Again, all programmatically with no code in the XAML.


Any help is appreciated.



Link to comment
Share on other sites

Ok, I still need the answer to the above,, but here is what I have so far...

List<comparisons> dataPts = new List<comparisons>();for (int i = 0; i < appointmentTimes.Length; i++)


dataPts.Add(new comparisons(appointmentTimes, Grades));



Chart chart1 = new Chart();chart1.ClipToBounds = true;

chart1.PointCount = Grades.Length;


true;chart1.Gallery = Gallery.Line;

chart1.Data.Series = 2;

chart1.ItemsSource = dataPts;

Here is where I am stuck... This will plot ONE line, but how do I enter the data for the baseline(2nd line) in C#? Cannot figure out the correct way to use series.


Secondly, how do I use the transform in C# to place the correct angles for the 3d line...


Third , How do you actually make the line into a ribbon - what is the call in C#.


Fourth. Why doesn't my clip to bounds work? I end up filling just the corner of the canvas. I need it to be dynamic based on the canvas container so that it will work in different resolutions.

Fifth, how do I change it into one of those cool Gel elements in C#




Link to comment
Share on other sites


 Here is a very simple example that follows the similiar setup to urs, this adds a series, and if u do the same process again it will add a seperate series.  You have to set the ItemSource to null because for some reason it won't instantiant otherwise


ChartFX.WPF.SeriesAttributes series = new ChartFX.WPF.SeriesAttributes();

this.m_Report.chart1.ItemsSource = null;

List dataPts = new List()

; for (int i = 0; i < value.Length; i++)

{ dataPts.Add(value); }


series.ItemsSource = dataPts;


Link to comment
Share on other sites

 I do not know the answer to this question, however:

I have a question for you.  Your code uses a List of <comparison> which I am assuming is a user made class so that you can hold X and Y points.  I created something similiar called XYMeasure based on the sample.  My code works perfectly when I have it as a List of doubles as I showed, but when I use this class It compiles but when I call m_Report.ShowDialog() (my name for the entire window)  it does not display and has a null exception thrown.  Is there anything special about your <comparison> class, and if soo can i see it, if not how do you display the chart(s).  Currently mine is derieved from Window but you can also derive it from usercontrol among other things.


Thanks alot!

edit: when I get caught up I can try to look into this other issue for you because i will need that as well.

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...