dundas legend checkbox

http://support.dundas.com/Dashboard3.Legend_Usage.ashx

lements of a legend

The figure below shows the main elements of a legend control. By default, the background of a legend is transparent, and no border is visible.

Elements of a legend.

Elements of a legend.


Usage

Adding a legend and connecting it to a  data visualization control  is similar for all controls. The  chart  is used below as an example.

Adding a legend to a chart

In this example, assume that you have already created a dashboard to display two series ( i.e.  KPIs) on a line chart:

A line chart displaying two KPIs.

A line chart displaying two KPIs.


Follow these steps to add a legend to the dashboard:

  1. Go to the toolbox in the Dashboard Designer and expand the Data Controls folder.
  2. Drag the Legend item from the toolbox and drop it onto the dashboard canvas.
    Toolbox item for legend.
  3. The legend appears on the canvas with a default appearance (which indicates that it is not hooked up to any data visualization control yet).
    Legend default appearance.

Next, connect the chart to the legend:

  1. Select the chart control on the canvas, then go to its Properties grid.
  2. Set the chart's Legend property to Legend1. The appearance of the legend on the canvas is automatically updated to reflect the KPIs and other elements displayed in the chart.
    Chart legend properties.
  3. Save, then preview your dashboard.

Chart with corresponding legend.

Chart with corresponding legend.


Checkbox legend items

It's easy to set up an interactive legend that displays a checkbox beside each legend item. Users can toggle a checkbox in order to show or hide the corresponding series ( e.g.  KPI) in the chart:

  1. Drag a legend control from the toolbox to the canvas.
  2. Set the chart's Legend property to Legend1.
  3. Set the legend's Item Checkbox Visible property to True.
    Item Checkbox Visible property.
  4. Save, then preview your dashboard.

Toggle a legend item checkbox to show or hide the corresponding series (KPI) in the chart:

Legend with checkbox items.

Legend with checkbox items.


Item Check Changed interaction

When you add a legend control to your dashboard, a script is automatically added to the advanced collection property  Item Check Changed Interactions :

Item Check Changed Interactions advanced property.

Item Check Changed Interactions
advanced property.


For reference, here is the script that is generated:

if (e.ParentControlElements.Count > 0)
{
  for(int i=0;i<e.ParentControlElements.Count;i++)
  {
    if (e.IsChecked)
    {
      e.ParentControlElements[i].Visibility = Visibility.Visible;
    }
    else
    {
      e.ParentControlElements[i].Visibility = Visibility.Collapsed;
    }
  }
}

Category headings

Multiple data visualization controls can be connected to a single legend control on the canvas, and they may display different types of items. For example, two charts can have the  Legend  property point to the same legend. In this case, some of the items in the legend correspond to one chart, while the remaining items correspond to the second chart. To help group or separate legend items, you can use category headings as follows:

  1. Select the legend control and go to its Properties grid.
  2. Select a data visualization control and go to its Properties grid.
  3. Set the Legend Category property to your desired heading text.
    Legend Category property.
  4. Repeat steps 2 and 3 as needed.
  5. Save, then preview your dashboard.

The resulting legend displays category headings above each group of legend items with the same category:

Legend with category headings.

Legend with category headings.


Some data visualization controls have separate legend settings for different elements, such as the series or strip lines of a chart. To categorize those elements separately from each other, locate and set their  Legend Category .

Note: If there is only one legend category, its header will not be displayed by default. To display the category header when there is only one category, set the legend's  Category Visibilityproperty to  True. (It is normally  Auto.)

Category Visibility property.

Horizontal alignment

Use the legend's  Item Horizontal Alignment  property if you want to change the alignment of the legend items. For example, you can align the legend items to the right, or have them centered.

If you want to control the horizontal alignment of a single legend item, you can do this from script by accessing the legend's  LegendItems  property, which gives you access to all of the legend items (available for scripting only). The example code below centers the first legend item:

Legend1.LegendItems[0].HorizontalAlignment = HorizontalAlignment.Center;


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值