Methods

This section describes the methods that can be used in code to manipulate the dxPieChart object.

Use the dxPieChart registered method to access the dxPieChart object, as demonstrated in the code below.

var pieChart = $("#pieChartContainer").dxPieChart("instance");

beginUpdate()

Prevents the widget from refreshing until the endUpdate method is called.

The beginUpdate and endUpdate methods allow you to apply several modifications to the widget. After the beginUpdate method is called, the widget does not raise events, and does not rerender itself until the endUpdate method is called. Using these methods prevents excessive widget updates when changing multiple widget settings at once.

Show Example:
jQuery

In this example, the legend | visible and tooltip | visible options can be changed using the buttons below the chart. To alter the values of these options, click the beginUpdate() button. The options will be changed, but the chart will not be refreshed until you click the endUpdate() button.


                                    

                                    

clearSelection()

Deselects the chart's selected series. The series is displayed in an initial style.

To learn about series selection, refer to the Selection Handling help section.

Show Example:
jQuery

In this example, click a slice to select it. Since the pointSelectionMode is set to multiple, more than one slice can be selected. To deselect all the slices, click the 'Clear selected points' button. The chart's clearSelection() method will be called.


                                    

                                    

endUpdate()

Enables the widget to refresh after the beginUpdate method call.

The beginUpdate and endUpdate methods allow you to apply several modifications to the widget. After the beginUpdate method is called, the widget does not raise events, and does not rerender itself until the endUpdate method is called. Using these methods prevents excessive widget updates when changing multiple widget settings at once.

Show Example:
jQuery

In this example, the legend | visible and tooltip | visible options can be changed using the buttons below the chart. To alter the values of these options, click the beginUpdate() button. The options will be changed, but the chart will not be refreshed until you click the endUpdate() button.


                                    

                                    

getSeries()

Provides access to the dxPieChart's series.

Return Value: Object

The dxPieChart's series.

Show Example:
jQuery

In this example, you can show tooltips using the button below. When clicking the Show next tooltip button, the showTooltip() method of the next point in the order will be called. Access to this point is provided by the chart's getSeries() and the series' getAllPoints() methods.


                                    

                                    

hideTooltip()

Hides all widget tooltips.

Use this method to hide all widget tooltips programmatically.

Show Example:
jQuery

In this example, you can show and hide tooltips using the corresponding buttons below. When clicking the Show next tooltip button, the showTooltip() method of the next point in the order will be called. When clicking the Hide all tooltips button, the chart's hideTooltip() method will be called. This method clears the chart plot from tooltips.


                                    

                                    

instance()

Returns an instance of the widget.

Return Value: Object

An instance of the widget.

Use this method to access the widget.

Show Example:
jQuery

In the following example, the instance() method is used to get access to the chart options. This method is called not like the other methods. To call the instance() method, the following construction is used:

<!--JavaScript -->$("#pieChartContainer").dxPieChart("instance")

Use the button below to show the tooltip of the next point in order.


                                    

                                    

option()

Returns the object representing the configuration options of the widget.

Return Value: Object

The object representing the configuration options of the widget.

Use the fields of the returned object to configure the widget.

Show Example:
jQuery

In this example, the option() method is used to obtain the value of the legend | visible option and display it under the chart. To change this value, use the check box below.


                                    

                                    

option(optionName)

Gets the value of the specified configuration option of the widget.

Parameters:
optionName: String

The name of the option to get.

Return Value: any

The value of the specified option.

To get the value of a configuration option, specify the path to the field representing this option in the configuration object. For example, pass the "commonAxisSettings.visible" value as the optionName parameter to get the value of the commonAxisSettings | visible option of the dxChart widget.

Show Example:
jQuery

In this example, the option(optionName) method is used to obtain the value of the legend | visible option and display it under the chart. To change this value, use the check box below.


                                    

                                    

option(optionName, optionValue)

Sets a value to the specified configuration option of the widget.

Parameters:
optionName: String

The name of the required option.

optionValue: any

The value to be assigned to the required option.

To set a value to the configuration option, specify the path to the field representing this option in the configuration object. For example, to set the commonAxisSettings | visible option of the dxChart widget to true, pass the "commonAxisSettings.visible" value as the optionName parameter and the "true" value as the optionValue parameter.

Show Example:
jQuery

In this example, the option(optionName, optionValue) method is used to set the value of the legend | visible option at runtime. To change this value, use the check box below.


                                    

                                    

option(options)

Sets one or more options of the widget.

Parameters:
options: Object

An object containing required configuration options.

To set one or more widget options, pass the object containing these options as the options parameter.

The following code sample illustrates the example of the object to be passed as this parameter.

JavaScript
var newOptionsObject = {
    commonAxisSettings: {
        visible: true,
        grid: {
            visible: true
        }
    }
}

This method is useful if you need to configure several widget options at once.

Show Example:
jQuery

In this example, the option(options) method is used to alter a set of options at once. To change the values of the legend | visible and tooltip | enabled options, use the check box below.


                                    

                                    

render(renderOptions)

Making a widget rerender.

Parameters:
renderOptions: Object

An object containing rerendering options.

By default a widget rerenders when the size of the parent window is changed. But there may be situations when a chart should be rerendered manually, i.e., when the size of the chart's container is changed. To make a widget rerender, use the render method.

Call the render method without a parameter after the size of the chart's container is changed. Alternatively, call the render method with an options object as the parameter. This object should contain the force field set to 'true'.

Show Example:
jQuery

Click the 'Change the container size' button to switch between two sizes of the chart container. You can set the size either to 400x600 or 300x500 pixels. The render method without parameters is used to redraw the chart after the container size changes.