Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
master_t
Partner - Creator II
Partner - Creator II

Creating a visualization with custom data

Hi everyone

I'm trying to use the visualization API to create a chart on the fly, as described here:

https://help.qlik.com/en-US/sense-developer/June2018/Subsystems/Mashups/Content/Create/Visualization...

However, I don't want to use dimensions/measures already in the model for this, I would like to supply my own data directly via javascript.

First of all, is this even possible? And if so, how?

I've tried something like this:

 

 

app.visualization.create(
	'barchart',
	[
		"=ValueList('a', 'b', 'c')", //this dimension definition works
		"???" //but how do I define the measure?? Is it possible?
	],
	{
		"showTitles": true
	}
)
.then((vis) => {
	vis.show("graphContainer");
	});

 

 
I've managed to create the dimension on the fly using the ValueList function, but the problem is that I don't know how to define an associated measure in a similar way. Can it even be done?
Labels (1)
1 Solution

Accepted Solutions
master_t
Partner - Creator II
Partner - Creator II
Author

Thanks, but what I actually wanted to do is pass in the values, not a function.

I managed to do this by using a measure definition like this:

=Pick(RowNo(), "1, 2, 3, ...")

 

View solution in original post

2 Replies
ajaykakkar93
Specialist III
Specialist III

Hi,

Her it what you can do

app.visualization.create( 'barchart', [ "=ValueList('a', 'b', 'c')","=sum(2)"], { "showTitles": true } ) .then((vis) => { vis.show("graphContainer"); });

 

regards,

Ajay Kakkar

Please mark the correct replies as Solution. Regards, ARK
Profile| GitHub|YouTube|Extension|Mashup|Qlik API|Qlik NPrinting

master_t
Partner - Creator II
Partner - Creator II
Author

Thanks, but what I actually wanted to do is pass in the values, not a function.

I managed to do this by using a measure definition like this:

=Pick(RowNo(), "1, 2, 3, ...")