Getting Started with DataVisualization for Windows Phone 7

Posted Fri Feb 4, 2011 @ 11:37 AM

Windows Phone 7 represents a huge advance in mobile technology from Microsoft, ComponentArt is proud to support this exciting new platform with a full suite of DataVisualization controls for Windows Phone 7 Apps.

GETTING STARTED

Windows Phone 7 development requires the Windows Phone Developer Tools for Visual Studio 2010. They can be downloaded from http://create.msdn.com/en-us/home/getting_started.

INCLUDED CONTROLS

The following is a list of the controls included in the Silverlight 4 and Windows Phone 7 editions:

 

DEVELOPMENT

Developing for Windows Phone 7 using the ComponentArt DataVisualization controls is very similar to developing for the Silverlight browser-based and OOB platforms. The API calls are identical and use the same documentation. One thing you will notice is that when you test a project it launches in the Windows Phone 7 Emulator, this is a virtual phone which really assists in development and debugging. One thing to keep in mind as you develop is that the performance of an app on the emulator can differ from that on an actual phone device – sometimes the animations are smoother on the actual phone, sometimes page loading times are shorter when using the Emulator. All screen shots in this post are from the emulator.

QUICK START

In this tutorial we'll go ahead and implement a simple chart using points from a binding to an ObservableCollection type. The source for this project is included in the CTP .zip file available at http://www.componentart.com/download/dv.aspx

Step 1.

Create a new Project, under Installed Templates select Silverlight for Windows Phone, choose a Windows Phone Application.

Step 2.

Under References add a reference to ComponentArt.Silverlight.DataVisualization.Charting.

Step 3.

Open MainPage.xaml and add the following to the Namespace declarations at the top of the file:

xmlns:my="clr-namespace:ComponentArt.Silverlight.DataVisualization.Charting;assembly=ComponentArt.Silverlight.DataVisualization.Charting"

Step 4.

Add the following to the Grid marked “ContentGrid”:

    <my:XYChart EnableAnimation="False"
                DataSource="{Binding}"
                XPath="X" >
        <my:BarSeries YPath="Y" BarKind="Block" />
    </my:XYChart>

Step 5.
Add the following to make your MainPage.xaml.cs look like this: 
using System;
using Microsoft.Phone.Controls;
using System.Collections.ObjectModel;

namespace QuickStart
{
    public partial class MainPage : PhoneApplicationPage
    {
        ObservableCollection<DataPoint> PointCollectionQ1 = new ObservableCollection<DataPoint>
        {
            new DataPoint { X = "January", Y=100},
            new DataPoint { X = "February", Y=300},
            new DataPoint { X = "March", Y=600},
        };

        public MainPage()
        {
            InitializeComponent();
            DataContext = PointCollectionQ1;
        }
    }

    public class DataPoint
    {
        public string X { get; set; }
        public int Y { get; set; }
    }
}

Step 6.
Test your project in the Emulator, it should end up looking like this:

 

This example demonstrates how easy it is to get up and running with ComponentArt DV for Windows Phone 7.

BONUS STEP

To change the colors of the bars add the following to the XYChart tag:

UseDifferentBarColors="True" Palette="VibrantB"

Try out the different palettes that ship standard with ComponentArt DV, the full list can be found here: http://docs.componentart.com/default.aspx?content=SlDataVisualization/2010/ComponentArt.Silverlight.DataVisualization/CommonConcepts_Theming.htm under Included Palettes.
LICENSING While testing the ComponentArt WP7 Demo application the DV controls will appear as licensed, however if you use the DV controls in your own project you will need to license them to get rid of the unlicensed overlay. See the following pages in the documentation to license your project.
Filed under: ,

Comments

Posted on Fri Feb 4, 2011 @ 11:37 AM

I am very pleased to announce our latest release -- ComponentArt Data Visualization for Windows Phone

Posted on Fri Feb 4, 2011 @ 11:37 AM

Hi...

Can't get your sample to work :-/..

I am prompted to add a reference to System.windows.browser... but still after that it doesnt work

Click here to log in or create an account.