开发者

Windows Phone 7 Charting/Graphing Controls

We're working on a Windows Phone 7 prototype application and w开发者_运维问答e need a Graphing/Charting control to work with. We looked at the Silverlight Toolkit, which has some controls that look like they would work great. However, we can't get that to work. Whenever we add a control to the XAML from that toolkit, it will throw an exception when trying to load the XAML at runtime, even though it appears to work in the designer. I think that it's because there's some dependencies that the phone doesn't actually support.

Does anyone know how to fix the problem or know of charting software that works on Windows Phone 7?

Here's an example of code that doesn't work. We downloaded and installed the 4.0 beta of Silverlight Toolkit. Added the DLL as a reference. Added this to import the namespace:

xmlns:c="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"`

then added this to make a chart:

<c:Chart>
    <c:PieSeries>
        <c:PieSeries.ItemsSource>
            <l:IntList>
                <sys:Int32>23</sys:Int32>
                <sys:Int32>2</sys:Int32>
                <sys:Int32>1</sys:Int32>
                <sys:Int32>34</sys:Int32>
            </l:IntList>
        </c:PieSeries.ItemsSource>
    </c:PieSeries>
</c:Chart>

the designer shows the pie perfectly, however when I try to compile and deploy it throws an exception saying that it can't find the MainPage.xaml. Which leads me to believe that MainPage.xaml isn't compilign correctly (not sure, as I'm still a newbie at Silverlight)

Here's the exception:

System.Windows.Markup.XamlParseException occurred
  Message=2255 An error has occurred. [Line: 36 Position: 2]
  LineNumber=36
  LinePosition=2
  StackTrace:
     ...

on this line:

System.Windows.Application.LoadComponent(this, new System.Uri("/Twitpic;component/MainPage.xaml", System.UriKind.Relative));


You can probably reuse some of the things provided by the silverlight toolkit, which is open source:
http://silverlight.codeplex.com/Wikipage

You might have to recompile some stuff against the win phone APIs, but it should work :-)


It looks like someone else has had the same issue as you and solved it by using the Silverlight Toolkit version 3

http://silverlightfeeds.com/post/2502/Windows_Phone_7_RTM_charting_using_the_Silverlight_Control_Toolkit.aspx


Just found these free WP7 charts: amCharts for Windows Phone 7


If you are looking for great charting on WP7, I suggest Visifire. Note that its a commercial offering. Has gesture support too! I've seen very less charting vendors who've optimized charting for mobile-form-factor like these guys do.

You can try MS Toolkit, if you are looking for free basic charts.


Playing around more, I was actually able to get Visifire to work. Just had to browse and add the reference to System.Windows.Browser. I don't know if this is the best way to make it work. But it'll do until the Silverlight Toolkit gets updated.


Macadamian team developed and gives for free a Chart Control. You can pick it up at http://themobileexperience.macadamian.com/2010/05/chart-control-for-windows-phone-7.html

Ani


Just a quick plug for my own graph control I recently released to open source:

Check it out, it scales to hundreds of thousands of points and responds to pinch,zoom,translate and tap gestures:

http://touchgraphwp7.codeplex.com/


A couple of options worth a look.

David Anson's blog and thread posting on charting.

Chart Control for Phone

Why didn't I think of that in the first place? [Windows Phone 7 Charting example updated to include reusable, platform-consistent Style and Templates] - Delay's Blog

And a commercial offering.

Silverlight, WPF & WP7 Chart Controls


This one too

http://www.visiblox.com/examples

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜