I wrote a query which returns me Confluence Space Name and Number of active pages in it. I nested PocketQuery Macro in Chart Macro to have bar graph. The rendering failed because one of the space name has '&' in it. Using just PocketQuery macro returns me a table without any errors.
Here is the error i am getting:
The entity name must immediately follow the '&' in the entity reference. Nested exception: The entity name must immediately follow the '&' in the entity reference
.I modified my query to omit the space with & and bang the chart appeared perfectly.
We are on MySQL
Hi Pranjal,
regarding the chart colors, you can take my last example in the article PocketQuery templating. You need to provide your own data table to the charts API that you can build up from the query result. For this you need to do some JS programming along these lines:
<script> (function() { // result from the query as array of row objects var result = PocketQuery.queryArray(); // the new datatable for the chart var dataTable = []; // some logic to get the data you with into the new dataTable $.each(result, function(rowNumber, rowObject) { dataTable.push(rowObject.nameColumn, rowObject.numberColumn, 'someColourHere'); }); PocketQuery.chart('BarChart', { title: "Density of Precious Metals, in g/cm^3", width: 600, height: 400, bar: {groupWidth: "95%"}, legend: { position: "none" }, dataTable: dataTable // provide a custom data table for the chart }); }(jQuery)); </script>
Let me know if you need further help!
Felix
Felix,
The above template doesn't seem to work. Could you please check once again?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pranjal! I'll call this P4 according to what we wrote in your other request
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pranjal,
Thank you for your interest in PocketQuery! There seems to be an issue with the Chart macro which apparently breaks with different combinations:
https://jira.atlassian.com/browse/CONF-33581
Have you tried to use the PocketQuery chart abilities instead? You could create a custom template for a 'BarChart' as explained in the PocketQuery documentation or the article on templating.
You could probably try with this template as a starting point:
<script> PocketQuery.chart('BarChart'); </script>
Let me know if this helps!
Regards, Felix (Scandio)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I did try but the bars are getting smudged as their are 20 odd. Any way to increase the size of the chart the way it's there in chart macro?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes of course you can configure the size. You can basically pass all possible options to the PocketQuery.chart call, see here: https://developers.google.com/chart/interactive/docs/gallery/barchart#configuration-options For example, this will make the chart 400px high, 700px wide and each bar 20px wide: <script> PocketQuery.chart('BarChart', { height: 400, width: 700, bar: { groupWidth: 20 } }); </script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Felix, I have a question. How do i change the color of the bars in PC charts. The examples you pointed me to are defining bar colors while defining the data. In this case data is getting populated via query. I could relate that in PC function PocketQuery.chart(), second argument is actually variable options defined in goggle examples. var options = { title: "Density of Precious Metals, in g/cm^3", width: 600, height: 400, bar: {groupWidth: "95%"}, legend: { position: "none" }, };
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.