It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

PocketQuery failing when resultant has & in it

Pranjal Shukla Nov 18, 2015

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

2 answers

0 votes
Felix Grund Nov 18, 2015

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)

Pranjal Shukla Nov 18, 2015

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?

Felix Grund Nov 18, 2015

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>

Pranjal Shukla Nov 19, 2015

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" }, };

0 votes
Felix Grund Nov 23, 2015

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:

&lt;script&gt;
(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));
&lt;/script&gt;

Let me know if you need further help!

Felix

 

Pranjal Shukla Feb 17, 2016

Felix,

The above template doesn't seem to work. Could you please check once again?

Felix Grund Feb 22, 2016

Hi Pranjal! I'll call this P4 according to what we wrote in your other request wink

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Confluence

6 Awesome Ways to Apply Trello, JIRA and Confluence to your Project

I attended  Atlassian Summit 2019  and learned a lot from the presenters, attendees and knowledgeable Atlassian product managers. The presentations I attended focused on applying Agile, pla...

2,110 views 11 27
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you