Pages Menu
TwitterRssFacebook

Posted by on Dec 5, 2010 in Development | 0 comments

Silverlight PivotViewer: so fast to develop

On Friday, I created a working demo of the PivotViewer that demo’d in the Silverlight Firestarter keynote, which I blogged about a couple of days ago. Apart from being a ‘wow’ demo, I was keen to see how easy it was. I was so impressed with the speed at which you can have something running that I thought it was worth a rough time line from Friday.9am: had the initial idea, went looking for documentation and examples. This was an R&D project so I was happy using static, rather than webservice-driven data. The PivotViewer Team have provided an Excel add-in that let’s you put all the data together in Excel, then automatically converts it to the required XML based format and creates all the DeepZoom images. Brilliant idea from the Silverlight team to lower barrier to entry.

9.30am: By this point I’d created the data in the specialised Excel workbook. I couldn’t initially work out why the Preview button wasn’t working: turns out you need to install the Silverlight local PivotViewer which then allows you to view PivotViewer instances locally: you can get this from http://content.getpivot.com/resources/Pivot.en-us.msi.

10am: I used the local preview to refine the data, by altering the number of categories, searchable keyword columns and info pane data. I then published locally using the provided Publish tool built into the Excel spreadsheet. What this does is create a .cxml file which defines the content, and a load of xml and image files which are the DeepZoom content files. I took these, and hosted them locally in a new IIS instance. (You have to add a MIME type for CXML in order to serve it)

10:30am: I could have stopped there, but I thought I’d host the PivotViewer on a webpage, rather than using the local previewer. This was relatively easy (there’s a great CodePlex walkthrough here) but I ran into a couple of little problems that delayed me:

  • You need to be using Silverlight 4 and hosting the app in .NET 4. Otherwise the control doesn’t seem to work, and you won’t know why.
  • If you are hosting your .cxml and resources somewhere else, like I was, then you need to have a clientaccesspolicy.xml file on the server with the resources, which controls access. More information about this can be found on MSDN.
  • Host your PivotViewer control in a Grid. Don’t try and get all fancy like I did, and put it in a StackPanel. You’ll get odd behavior, like everything loading, but no tiles, and it’ll take you hours and hours to fix! Error reporting in Silverlight still could be better, and inconsistencies like this make things hard when you’re trying to get to grips with new technologies. Stick to the basic examples shown, get them working, then experiment.

I had to do some real work that day as well, but basically I was emailing round a working demo hosted locally by 4pm. This control really is amazing – the way that as a developer I can take my data and show it to users so visually and in a way that enables them to get original insight from it: it’s brilliant!

I can’t show the example I created, as it’s based on internal data for the company I’m working for. However, I’m creating another one at the moment using public-domain data, so hopefully I’ll have that available in the next couple of days.

Post a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This site uses cookies to help make this website better. By continuing to use this site we’ll assume you’re OK with that (implied consent).