416.467.9100 | Dundas Data Visualization | Login
Welcome Guest
This is the support page for the legacy Dundas Dashboard application. For assistance with the current Dundas BI application please click here.
Dashboard v5.0

This site makes extensive use of JavaScript.

Please enable JavaScript in your web browser and reload the page before proceeding.

Changing a gauge's bar color based on its value

Hide navigation
Modified on Fri, 31 Aug 2012 05:35 PM Categorized as Gauge, Script Library
&dw; Script LibraryPrevious

Suppose you want to change the color of the bar to red when the value is greater or equal to 10, you may do the following:

  1. In Dashboard Designer, click the white area of the dashboard.
  2. In the properties list, click to open the On Load Interaction list. This will bring up the code dialog.
  3. Add a new script (like the one below) in the dialog.


// Check the value of the thermometer bar. We will change the colour // if the value is equal to or above 10. // // Assumption: the ID of your thermometer gauge ThermometerGauge1. if (ThermometerGauge1.Scales[0].Pointers[0].Value >= 10) { // To change the colour, we need to first create a brush. For // demonstration purposes, we will create a simple solid colour brush. DashboardSolidColorBrush brush = new DashboardSolidColorBrush(); brush.Color = Colors.Red;

// Set the thermometer gauge to use the new brush. ThermometerGauge1.Scales[0].Pointers[0].Fill = brush; }


The bar inside the thermometer is now brushed in red.

The bar inside the thermometer is now brushed in red.

About Dundas | Contact Us Follow us on Twitter! | Privacy Statement | Report Site Issues

Copyright © 2009-2014 Dundas Data Visualization, Inc.