piyush singh piyush singh - 1 year ago 111
AngularJS Question

Get generated bar colour dynamically

Is there any way to generate bar colours dynamically in ZingChart?
in screen-shot there is two colours generated in bar chart, i want to get list of colors used in bar chart.
enter image description here

html file

<zingchart id="timesheet-bar-chart" zc-values="barValues" zc- json="myObj"></zingchart>


$scope.myObj = {
"type": "bar",
"stack-type":"normal" /* Optional specification */
"all":"%d %M",
"item": {

and barValues is a list of integer values.

Answer Source

You can set the colors like this,

$scope.myJson = {
        'plot': {
        'styles': ['#yellow', 'red', 'blue']
      'scale-x': {
        'values': ['white', 'red', 'pink']
      'type': 'bar',
      'series': [{
        'text': 'Product History Color',
        'values': [2, 6, 8]


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download