#1 2015-03-02 13:34:19

zzgvh
Member
From: Stockholm
Registered: 2014-12-12
Website

Customizing SAIKU_CHART_HTML exported charts

I love the export functionality exposed using SAIKU_CHART_HTML. But I'd like to be able to customize the result further and wonder if it's possible to get access to the resources underlying the full HTML page that you get using /httpauthexport?format=SAIKU_CHART_HTML.

Looking at the source for an export I see:

<!DOCTYPE html>
<html>
    <head>
	<script type="text/javascript" src="../resources/saiku/js/jquery/jquery.min.js"></script>
	... and a bunch of other imports
    </head>
    <body>
	<script type="text/javascript" src="../resources/saiku/js/saiku/plugins/CCC_Chart/plugin.js"></script>
		
	<script>
		$(function(){
			var data = {"cellset":[[{"value":"Date","type":"ROW_HEADER_HEADER","properties":{"hierarchy":"[Date]","dimension":"Date","level":"[Date].[Date]"}},
			...;
		
		// code to render the chart using the data var
		});
	</script>	
	<div class="workspace">
		...
	</div>		
	</body>
</html>

Is there maybe a way to access the JSON that populates the data variable above for instance? That would allow me to write a page that defines a chart area etc into which I could pull arbitrary data and also add some additional styling.

Or maybe there's some different way to embed a dynamic list chart? Note that for this it's of great interest to me to be able to use /httpauthexport so the charts may be publicly available.

Cheers,
/GvH

Offline

#2 2015-03-02 13:43:39

Thorsten J. Krause
datenwerke
Registered: 2012-02-15
Website

Re: Customizing SAIKU_CHART_HTML exported charts

Hi,

look for the file charttemplate.html in war/resources/saiku/charttemplate.html. This file is used as the template for all chart exports.

Cheers,
Thorsten

Offline

#3 2015-03-02 14:46:00

zzgvh
Member
From: Stockholm
Registered: 2014-12-12
Website

Re: Customizing SAIKU_CHART_HTML exported charts

Ah, right. So after looking at the template my question becomes: is there any way to expose the data I presume is rendered server-side to replace /*##DATA##*/ so I can get at it as a JSON object via a URL?

Cheers,
/GvH

Last edited by zzgvh (2015-03-02 14:49:35)

Offline

#4 2015-03-02 15:04:40

Thorsten J. Krause
datenwerke
Registered: 2012-02-15
Website

Re: Customizing SAIKU_CHART_HTML exported charts

There is no built in function to just get the json part, but you could write a custom output generator that does this. The script guide contains more information on registering a custom output generator. For you implementation you can basically copy the SaikuChartHTMLOutputGenerator and just strip away the part that integrates the json-string with the template.

Cheers,
Thorsten

Offline

#5 2015-03-02 21:09:17

zzgvh
Member
From: Stockholm
Registered: 2014-12-12
Website

Re: Customizing SAIKU_CHART_HTML exported charts

Allright, time to get serious with scripting!

As always, thanks for your great guidance,

/GvH

Offline

Board footer

Powered by FluxBB