How to change bar color in pocket query template
Asked by ChandraG:

I want to change bar color in pocket query template which is written as below, default color is blue but i want to change as per my requirement. Please suggest.

******\<script\>
PocketQuery.chart('ColumnChart', {
title: ''Test",
width: 500,
height: 450,
showTip: true
});******  
[](https://community.atlassian.com/t5/Confluence-questions/How-to-change-bar-color-in-pocket-query-template/qaq-p/369991?attachment-id=8494){#link_1185bbe3dffafd}  
[](/tnckb94959/attachments/tnckb94959/confluence-questions/62507/1/barchart.JPG){#display_1185bbe3dffafd_0}  
[](https://community.atlassian.com/t5/Confluence-questions/How-to-change-bar-color-in-pocket-query-template/qaq-p/369991?attachment-id=8495){#link_1185bbe3dffafd_0}  
[](/tnckb94959/attachments/tnckb94959/confluence-questions/62507/2/barchart_required.JPG){#display_1185bbe3dffafd_2}


Answers:
author: Carla Roocks (Scandio)
body: Hi Chandra,

Thank you for using PocketQuery!

To change the bar color, you simply need one more line of code:

```
&lt;script&gt;PocketQuery.chart('ColumnChart', {  title: "Test",  width: 500,  height: 450,  showTip: true,  colors:['#ff0000']});&lt;/script&gt;
```

Does this work for you?

Please let me know, if you need further help!

Best regards,

Carla

comments: author: Carla Roocks (Scandio)
body: Hi Chandra,

Did my answer solve your issue? If it did, it would be very helpful if you could "accept" it - that way other users can see at the first glance that this question has a working solution.


author: Kulbhushan Mayer
body: HI Harth,

Your answer has helped me to resolve the one point, is it possible to force barchart to start from 0 always and then accordingly it will create bar, instead of start it from some base value which is the lowest value like I have value starting from 52 so my bar chart starts from 50 instead of 0, and next value I have for other graph is 55, though the difference is not much but in graph its big, becuase graphs start from 50 not 0, could you please help me in this.


author: Carla Roocks (Scandio)
body: Hi Kulbhushan,

are we talking about a BarChart or a ColumnChart? Additionally, a screenshot of how your chart looks like right now and the code of your template would be really helpful.

There are options like "vAxis: {minValue: 0}" and "vAxis: {viewWindow: {min:0}}" and maybe they do what you need. But I can't say that for sure without some more details about your current setup.

Please, feel free to open a new question here on answers using the label "addon-de.scandio.confluence.plugins.pocketquer". Then we can get into more details there.

Regards,

Carla


author: Kulbhushan Mayer
body: we are talking about columnchart here,

\<script\>

PocketQuery.chart('ColumnChart', {

title: '',

width: 370,

height: 400,

colors: \['#66AA00'\],

bar: {groupWidth: "30%"},

legend: {position: 'none'},

showTip: true

});

\</script\>

<br />

<br />


author: Kulbhushan Mayer
body: Hi Carla,

Any update on this?

Thanks!

Kulbhushan Mayer


author: Carla Roocks (Scandio)
body: Hi Kulbhushan,

For me it worked with the option "*vAxis: {viewWindow: {min:0}}*" - have you tried that already?

My complete template looked like this (I hardcoded some data similar to yours, of course you can omit the whole*dataTable* attribute):

```
&lt;script&gt;PocketQuery.chart('ColumnChart', {	dataTable: [['Month', 'Value'], 		['JAN-17', 52.1],		['FEB-17', 51.2], 		['MAR-17', 51.7]		],	width: 370,	height: 400,	colors: ['#66AA00'],	bar: {groupWidth: "30%"},	legend: {position: 'none'},	showTip: true,	vAxis: {viewWindow: {min:0}}});&lt;/script&gt;
```

*Edit:* Alternatively, it should also work with "isStacked: true". You can find more information on this here: <https://developers.google.com/chart/interactive/docs/gallery/columnchart#stacked-column-charts>


author: Kulbhushan Mayer
body: Thanks Carla, It worked fine for me. I am marking this as bookmark this link for all our template queries :smile:


author: Carla Roocks (Scandio)
body: I am glad I could help :smile:

Two more links, that might come handy:

* We provide a templating tutorial including a number of Google charts examples: <https://help.scandio.de/documentation/display/PQDOC/Templating+Tutorial>
* And we only recently started to collect more Google chart templates on a seperate page, maybe this will be helpful in the future, too: <https://help.scandio.de/documentation/display/PQDOC/Google+Chart+Template+Examples>

Have fun exploring the possiblities of PocketQuery!

If you are satisfied with our plugin, would you mind leaving a review at the marketplace? We would highly appreciate!


author: Kulbhushan Mayer
body: Thanks again for the help you provide.


Tags: pocketquery