Rules

Methods to add, update and delete rules within your chart.

Note: Requires the zingchart-api-rules.min.js module.

addrule

DemoAdds a rule to a chart.


          
zingchart.exec('myid', 'addrule', {
    id : 'rule1',
    plotindex : 0,
    rule : '%node-value < 50',
    style : {
        'background-color' : '#f00'
    }
});
        
AttributeTypeInfo

graphid (optional)

Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

id

String

The id of the rule to be added.

"rule1" | "rule2"

plotindex

Numeric

The index of the plot.

0 | 1 | ...

rule

String

The rule parameters to be added.

"%node-value < 50" | "%v > 50" | ...

style

Object

The style to be applied when the rule parameters are met.

{ ... }

#### removerule [Demo](http://demos.zingchart.com/view/api-removerule)Removes a rule from a chart. ```text zingchart.exec('myid', 'removerule', { id : ['rule1', 'rule2'] }); ```

AttributeTypeInfo

graphid (optional)

Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

id

Mixed

The id or ids of the rule or rules to be removed.

"rule1" | ["rule1,"rule2"]

plotindex

Numeric

The index of the plot containing the rules to be removed.

0 | 1 | ...

#### updaterule [Demo](http://demos.zingchart.com/view/api-updaterule)Updates an existing rule. ```text zingchart.exec('zc', 'updaterule',{ id : 'rule1', plotindex : 0, style : { 'background-color' : '#aaa #333' } }); ```

AttributeTypeInfo

graphid (optional)

Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

id

Mixed

The id of the rule to be updated.

"rule1" | "rule2"

plotindex

Numeric

The index of the plot.

0 | 1 | ...

rule

String

The rule parameters to be updated.

"%node-value < 50" | "%v > 50" | ...

type

String

The style to be applied when the rule parameters are met.

"background-color" : "#f00" | "border-color" : "#ff0" | ...

On This Page