Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

Gauge - How to change options using the KnockoutJS approach

$
0
0

When using the Knockout approach to create a Gauge widget, some of the widget objects or all of them can be specified as ViewModel fields. Therefore, to get an option value, get a value of the corresponding ViewModel field. For example:


[JScript]
var viewModel = { linearGaugeOptions: { rangeContainer: { backgroundColor: 'green',...

[JScript]
var rangeContainerColor = viewModel.linearGaugeOptions.rangeContainer.backgroundColor;

However, if you require an option value that can be changed dynamically during an application flow and a widget that is updated in response to the option change, utilize observables. This example illustrates this approach in action:


[JScript]
var viewModel = { linearGaugeOptions: { scale: ko.observable({ majorTick: { showCalculatedTicks: false, customTickValues: [0, 15, 60, 100]}}),...

[JScript]
viewModel.linearGaugeOptions.title({ text: 'Title has been changed', position: 'top-left'}); viewModel.linearGaugeOptions.scale({ majorTick: { color: 'Red'}});


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>