Add a chart in Project Siena
In Project Siena, you can display data graphically in a column, line, or pie chart. For a general overview of Project Siena and links to resources such as sample apps, video tutorials, and forums, see Project Siena.
You can also find a short demonstration of chart features in this video on the Channel 9 page.
Prerequisites
Project Siena, which you can get for free from the Windows Store
You can find system requirements and other information in the release notes.
Familiarity with basic operations in Project Siena, as Create your first app describes.
Create a simple chart
Import data or create a collection that contains a column of labels and a column of data.
In a column or line chart, the labels will appear on the x-axis, and the data will determine the height of the line or column on the y-axis. In a pie chart, the labels will identify each pie piece, and the data will determine their relative sizes. In this collection, named Revenue2012, the Product column shows the labels, and the Revenue column shows the data.
Product
Revenue
Violins
$21,000
Trombones
$15,000
Bongos
$14,000
Add a chart, and set its data source.
With the chart selected, click Design, and then click Chart.
In the dialog box that appears, click MIN, and then set the minimum value to 0.
Create a chart with multiple columns of data
Import data or create a collection that contains a column of labels and multiple columns of data.
In a column or line chart, the labels will appear on the x-axis, each data series will determine the height of a line or column on the y-axis, and the legend wil identify each data series by color. In a pie chart, the labels will identify each pie piece, and you'll specify which data series to show. In this collection, named RevenueByYear, the Product column shows the labels, and the other columns show the data.
Product
2012
2013
2014
Violins
$21,000
$26,000
$28,000
Trombones
$15,000
$17,000
$21,000
Bongos
$14,000
$19,000
$23,000
Add a chart, and set its data source.
If you added a line or column chart, click it, click Design, click Chart, and then set the number of series to 3, and set the minimum value to 0.
If you added a pie chart and you want to change the series that it shows, perform these steps:
Click the chart, and then click Express View in the lower-right corner.
Under Data, open the Series list, and click the column of data you want the chart to show.
Create a chart that filters the data
If your data source is structured so that the labels are contained in multiple columns, you can show a specific series by filtering the rows. For example, this data source is named RevenueLedger:
Product |
YearID |
Revenue |
---|---|---|
Violins |
2012 |
$21,000 |
Violins |
2013 |
$26,000 |
Violins |
2014 |
$28,000 |
Trombones |
2012 |
$15,000 |
Trombones |
2013 |
$17,000 |
Trombones |
2014 |
$21,000 |
Bongos |
2012 |
$14,000 |
Bongos |
2013 |
$19,000 |
Bongos |
2014 |
$23,000 |
If you add a chart, set its data source to RevenueLedger, and set the minimum value of the y-axis to 0, that chart will look like this illustration because the labels are taken from only the first column:
However, you can get a clearer and more useful chart by adding a list by which you can filter the data by either year or product.
Import data or create a collection that follows the structure of the data earlier in this section.
Add a dropdown list, a listbox, or a radio-button control, and name it FilterCriteria.
Set the data source for FilterCriteria to a function that follows this syntax:
Distinct(DataSource,ColumnName)
For example, use Distinct(RevenueLedger, Product) if you want to show all data for a specific product or Distinct(RevenueLedger, YearID) if you want to show all data for a specific year.
Add a column or line chart, and set its data source to a function that follows this syntax:
Filter(DataSource,ColumnName=FilterCriteria!Selected!Result)
For example, use Filter(RevenueLedger, Product = FilterCriteria!Selected!Result if you want to show all data for a specific product or Filter(RevenueLedger, YearID = FilterCriteria!Selected!Result if you want to show all data for a specific year.
With the chart selected, click Design, and then click Chart.
In the dialog box that appears, click MIN, and then set the minimum value to 0.
In the lower-right corner, click Express View, open the Labels list under Data, and then click the name of the column from which you want to take the labels.
For example, click YearID if you're showing all data for a specific product, or click Product if you're showing all data for a specific year.
Click a list option or a radio button to display the data you specified.