Coordinate system problem with the grid control
In my WPF application im trying to visualize some temperature data. I have a list of temperatures for the 7 past days and want to make a point to point line diagram. My problem is with the different koordinatesystems and adjusting data to the grid.
XAML:
开发者_JAVA技巧<Grid Height="167" HorizontalAlignment="Left" Margin="6,6,0,0" Name="grid1" VerticalAlignment="Bottom" Width="455" />
C# (draft):
http://pastebin.com/6UWkMFj1
scale is a global variable that changes with a slider (1-10). How to i correct my application so the line always is centered? As it is now it starts out centeded but if i crank up the slider to 3-4 the line goes up and above the applicationwindow. I also would like to use the full height of the grid window not just a small piece like images below:
http://img32.imageshack.us/i/002wtvu.jpg/ http://img691.imageshack.us/i/001tqco.jpg/
As you can see i have worked out my data so day 1 with temperature 62 F is lower then day 2 with temperature of 76 F but i have scaling issues and placementissues... could somebody straighten out my math? :-)
I don't think that drawing on a grid is a good idea... Canvas should do... give it a try. Here is a link with related stuff that might be helpful.
精彩评论