官术网_书友最值得收藏!

  • .NET 4.0 Generics
  • David Lai Xavier Hacking
  • 896字
  • 2021-04-02 19:30:11

Adding a line chart to your dashboard

A line chart is very useful to visualize data that changes over time. It consists of a set of data points that are connected by a line. The horizontal x-axis typically shows the categories in which the data is divided. The vertical y-axis shows us the values.

This recipe shows how to add a line chart to a dashboard and how to link it to the data in the spreadsheet. Also, we will discuss the components that are similar to the line chart component—Bar chart, column chart, area chart, and stacked charts.

Getting ready

Open a new Dashboard Design file and enter the data into the spreadsheet, as shown in the following screenshot:

How to do it...

  1. Drag a Line Chart component from the Components browser into the canvas.

    Tip

    You can also click on the Line Chart component in the Components browser, move your cursor to the canvas area (the arrow will now change into a cross), and click again. You can use whatever method you prefer.

  2. Select the Line Chart component you just added to the canvas by clicking on it. Now the component is surrounded by eight blocks that enable you to adjust the size of the component.
  3. The properties pane for this component is also visible now. By default, the General tab is selected. In the Data section we can bind the data we entered earlier in the spreadsheet to this component. Click on the button on the right-hand side of the By Range field.
  4. In the spreadsheet, select the range from A4 to E7 and click on OK. The data is now bound to the component.
  5. The Data section of the properties pane now looks like the following screenshot. The chart will already show the data series we just bound.
  6. In the same way, we can add titles to this chart. Select spreadsheet cell A1 and enter Sales data; also, enter 2011 in cell A2.
  7. Bind the Chart field in the properties pane with spreadsheet cell A1 and bind the Subtitle field with cell A2.

    Tip

    You can also enter a value in these title fields directly.

  8. In the Category (Y) Axis field, enter Tonne.
  9. Your setup should now look like the following screenshot. Click on the Preview button to try the dashboard.

How it works...

This recipe showed how to connect the data in one or more spreadsheet cells to the Line Chart component through several options in its properties pane. This is how we bind data and you will be using this a lot during the development of dashboards with Dashboard Design.

There's more...

Manually binding data

In this recipe, we used a pretty straightforward data set with the category labels in the first row (Q1, Q2, Q3, and Q4) and the series names in the first column (Apple, Banana, Cherry). Dashboard Design is able to understand this data set and bind this information automatically. This may not always be the case, and therefore not always lead to the visualization you had in mind.

To change the direction of the visualization of the spreadsheet data in the chart, you can select the Data in Columns option in the Data section of the properties pane. This will switch the series and the labels.

By clicking on By Series in the Data section of the properties pane, it is possible to manually adjust all binding settings for the name and values of each series. Additionally, you can select the axis a series should be plotted on (primary or secondary). You can change the series order by using the two arrow buttons and add or remove series by using the + and - buttons. Also, you can manually bind the category labels to a range of cells.

Hide/show series

Series in a chart can be hidden or shown by the user when using the dashboard.

  1. Go to the Appearance tab and select the sub-tab Layout.
  2. Make sure that Enable Legend is selected.
  3. Select Enable Hide/Show Chart Series at Run-Time.
  4. Set Interaction to Check Box.

Other charts: bar chart and column chart

The bar chart and column chart components can be configured in exactly the same way as a line chart component. A bar chart presents values in horizontal bars while the column chart uses vertical bars. These types of charts are typically not used to present data over a long time period, but to show data from different categories that need to be compared.

Other charts: area chart

The area chart component is a line chart with a filled area beneath the line. Other differences between these types of charts are that for the area chart the first value (Q1) is plotted on the far left-hand side and the last value (Q4) on the far right-hand side of chart. An area chart is used to visualize the cumulated total value over a period of time. This component can be configured in the same way as the line chart component.

Other charts: stacked charts

The bar chart, column chart, and area chart component all have a stacked version—stacked bar chart, stacked column chart, and stacked area chart. These stacked chart components show the values for the series on top of each other in the same column. You can use the stacked charts if the dashboard user needs to be able to compare totals.

主站蜘蛛池模板: 绥江县| 内乡县| 郯城县| 邵阳县| 婺源县| 绍兴县| 石林| 永兴县| 鄂伦春自治旗| 北京市| 潮安县| 商水县| 西安市| 泰安市| 深州市| 公主岭市| 洮南市| 清河县| 察雅县| 钦州市| 博野县| 高唐县| 左云县| 包头市| 浙江省| 湘乡市| 千阳县| 六盘水市| 巧家县| 沁阳市| 石门县| 法库县| 卓尼县| 东阳市| 定边县| 山东| 河津市| 兰考县| 瑞丽市| 富民县| 蒲城县|