Getting started with PivotViewer control

Here is a basic walkthrough to get up and running with PivotViewer Control

After getting all the stuff as mentioned in the faq, Open VS2010 and create a silverlight application. Add a website hosted in IIS adding a clientAccesspolicy file as needed. Make sure it is set a startup project. Go the Property pages and select silverelightApplications and add a test page. set  the testpage as startup page. Make sure there are MimeTypes added in IIS for .cxml, .dzi and .dzc as “text/xml”

once you unzipped the tools,  you will find a docs folder in PAuthor folder. There is a sample.xlsx file. we will use that. The images are in the sample_images folder.

For simplicity, I copied everything in that folder to bin folder under PAuthor directory, If you are getting started, I would do the same, so we can get up and running without hiccups.

Go to command prompt to run the following command
Pauthor.exe /source excel sample.xlsx   /target deepzoom output\sample.cxml

one it is done in the “output” directory you will have “sample.cxml” and a folder “sample-deepzoom”. copy both of them to the website.

Now Add references to all the Pivot Assemblies from the folder “C:\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\PivotViewer\Jun10\Bin\”.  Not sure exactly which ones will be required as we are doing only minimal stuff.

open MainPage.xaml and add this namespace
xmlns:local=”clr-namespace:System.Windows.Pivot;assembly=System.Windows.Pivot”

Add the following XAML

 <Grid x:Name=”LayoutRoot” Background=”White”>
        <local:PivotViewer x:Name=”pv1″/>
    </Grid>

go to codebehind of the MainPage, after the line with InitializeComponent();

add the following line to load the collection. In my case the website name is “Mysample”
pv1.LoadCollection(“http://localhost/Mysample/sample.cxml“, null);

Now if you run the sample, you should have everything working

Advertisements

12 thoughts on “Getting started with PivotViewer control

  1. Have you been able to develop collections based off a backend DB like SQL Server? Can the design be more dynamic in terms of having unknown amounts of data that can change or does the whole design process rely on getting it into Excel first and generating the CXML file? Cheers!

  2. Can you release a tutorial with more details regarding HTML templates and how to create images based on data to present? TIA

    1. Are you trying to create physical images or at runtime(dynamic images, no physical files). if you are creating at rumtime, you dont need to use HTML Template.

      1. I have created some basic collections using the Excel tool. These collections only included data and no images, so my “tradecards” are blank when using in Big Pivot. I have not tried Little Pivot ( SL Version ) yet and I’ve not used images, either.

        What I would like to do is learn how to built the images or “tradecards” based on data in various fields of my collections. This does not have to be at runtime. Just to start off, maybe use the Pauthor Command Line tool ( or something else that will work ) to create the images.

        An example could be background color based on a vehicle type…. Blue = truck, Red for car and Yellow = SUV.

        So how/what tool would I used to create the images with the different backgrounds?

        Once I figure that out, the second step would be… How do I add text from various data fields to the images? Maybe have a text label that show the Make and Model of each vehicle.

        My initial goal would be to run a nightly build for collections based on some of my databases and upload to a specific path. Later on I would like to learn more of doing at runtime. Need the basics first.

        Any help would be nice. Thanks for reply.

        1. Hi,
          AFAIK Creating Images from HTML Templates( you can find a sample here http://getpivot.com/developer-info/cmd-line-tools.aspx) . you specify one template, don’t think it can be changed based on the vehicle type or something like that. If you were to create Dynamic Images, you would be able to generate different image based on atrributes. you would also be able to render different image based on the level (I think between 1 and 8, 8 being the most detailed)

  3. I’ll look over the Command Line tool to see if I can create a basic collection ( with just one image and fill in the data fields ) then. Since it seems like the Dynamic Images are what I need, is it possible to provide a basic walkthrough based on my vehicle example then? Thanks again for the help.

  4. I built the project but when I run it in debug, the browser opens with the “download silverlight” prompt. I downloaded it several times and the install tells me that the current version is installed, yet the browser keeps asking for it to be installed. I’m sure it is something simple, but I can’t figure it out. Any help would be appreciated.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s