Click here to Skip to main content
15,877,560 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I made a simple chart by putting stack panels on a canvas and then filling the stack panels with lables according to the data given.However I am not very happy with the performance.

If I change the stack panels with listboxes, and instead of lables add strings, would it be faster to render the data? The data I need to show is a subset from a large array of lists of strings. When I move the index, I have to clear all the listboxes and fill them with the new data.
Or is there a faster way to do it?

All my strings are of 4 characters. Is it possible to change the orientation to vertical so that each listbox shows something like this

A

A

A

A

B

B

B

B

C

C

C

C

D

D

D

D

etc...
The strings are AAAA, BBBB, CCCC, DDDD.
Posted
Comments
Sergey Alexandrovich Kryukov 25-Mar-11 0:08am    
OP commented:

Ok I am still very novice with WPF but I am learning slowly.
I need to display lists of strings on a chart stored in an array. Some lists might contain zero items while others might contain up to 20. I was using visiblox chart at first (since it supports zooming) but it does not support adding strings next to each datapoint.
So I created a zoomed in chart myself and when the user moves a slider, the chart updates with the proper data from the array. The chart consists of a canvas with 60 stackpanels next to each other representing the columns. The chart is working fine but it is taking a while to update when moving the slider making it look jittery.

So what I am asking is if there is a better way to implement it (which there is for sure).

@SAKryukov - thanks for the Vertical text block link.
Sergey Alexandrovich Kryukov 25-Mar-11 0:10am    
You're welcome. Please don't post non-answers as Answer.
--SA

For a vertical text, you can use implementation of VerticalTextBlock offered in this post: http://blogs.msdn.com/b/delay/archive/2008/06/19/text-from-a-slightly-different-perspective-verticaltextblock-control-sample-for-silverlight-2.aspx[^].

Now, dynamic adding the the canvas:

C#
TextBlock tb = new VerticalTextBlock();
tb.Text = "some text";
//... whatever properties your need
myCanvas.Children.Add(tb);


—SA
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 25-Mar-11 0:09am    
You're welcome.
Thanks for accepting this Answer.
Good luck,
--SA
Why are you putting stackpanels on a canvas? Are you animating the canvas? If not, it just seems redundant.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900