piyush singh piyush singh - 2 months ago 39
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.


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]