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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Scatter chart shows unexpected behaviour

Hi

I have tried to understand scatter charts in qlik but am stuck now as I can not see how it works.

I am using a simple table with id, x, y, cat fields

LOAD * INLINE [
id,x, y, cat
1,5, 5, 11
2,7, 6, 12
3,10, 6, 12
4,8, 6, 12
5,3, 5, 15
6,3, 4, 16
7,3, 3, 17
8,3, 2, 18
9,3, 1, 19
10,4, 1,20
11,4,2,5
12,4,3,5
13,4,4,5
14,4,5,5
15,4,6,5
];

I create a scatter chart and assign cat as dimension, x and y as expression.

This shows correct results only for data that has a unique category value. For the category 5 and 12, which have multiple positions, the chart shows nothing.

If I add the id field as first dimension (category second) the chart looks correct but only as long as I have more then one category in my selected data. Making a single category selection removes the category from the chart, shows the id as legend and assigns symbols/colors based on id instead of category.

Any workaround for this?

Thanks

Jürg

11 Replies
prieper
Master II
Master II

Hi,

think that you have to enter an aggregation-formula as expression, i.e. Sum(x) and Sum(y)

HTH

Peter

Not applicable
Author

Peter

tried this but it shows the same behaviour

Jürg

kji
Employee
Employee

The scatter chart will try toshow one data point for each unique combination of values in the dimensions, so giving only cat as the dimension will generate 1 datapoint for each value of cat, however if you have x, and y as expressions these will evaluate to NULL for cases where there is more than 1 unique value of x or y that value of cat.

As for the legend problem with your second approach, the legend is shown for the last non-degenerate dimension, so as soon as you select a single value from cat, that dimension will be degenerate and the legend will instead show id. You can turn off show legend on the id dimension to not show it, it will however then not show any legend for when a single value of cat is selected.

Not applicable
Author

Johan

Thanks for your explanations to understand what is going on behind the scenes.

What I actually try to achieve is showing stoppoints and buses on a scatter diagram with a google map background (as of map examples found in the share area).

I thought I could simply mix the locations and add the according category to distinct the 2 types of markers on the map.

What I would need then is a more sophisticated version of the scatter chart that would allow to bind dimensions to layers?

I thought of adding multiple scatter charts on top of each other with transparent backgrounds beside the lowest one showing the map but then I lose the option to select markers and show popups (beside being a nighmare to handle the "layers" for changes).

Any other ideas?

Thanks, Jürg

johnw
Champion III
Champion III

I haven't fiddled with maps, but if you make id the dimension, it will plot all the points at their X,Y coordinates. You can add cat as a second dimension as well, in which case each cat will get its own color, and it will connect the points. You can remove the lines or the symbols if desired on the presentation tab. Probably lots of other formatting that you can do.

Not applicable
Author

"if you have x, and y as expressions these will evaluate to NULL for cases where there is more than 1 unique value of x or y that value of cat."

I'm having the same problem. Is there a way around this? It seems that you should be able to set the dimension to something than can appear more than once in the data set and have the scatter chart plot the expressions as needed.

Not applicable
Author

Hi John

I assume you have to use an artificial ID which is kept unique when loading the data, then have x,y give the position.

The control of the different shapes however looks hard coded and wasn't really what I was looking for.

It's amazing what these map-guys did but - from my point of view - it touches the edges of what can be done at the moment with maps in qlik.

Jürg

johnw
Champion III
Champion III


John Banta wrote:"if you have x, and y as expressions these will evaluate to NULL for cases where there is more than 1 unique value of x or y that value of cat."
I'm having the same problem. Is there a way around this? It seems that you should be able to set the dimension to something than can appear more than once in the data set and have the scatter chart plot the expressions as needed.




I'm not understanding the problem or what you want to see. Can you post a QVD demonstrating the problem with an explanation of what you want instead from the same data set?

johnw
Champion III
Champion III


juergm wrote: I assume you have to use an artificial ID which is kept unique when loading the data, then have x,y give the position.

The control of the different shapes however looks hard coded and wasn't really what I was looking for.


I just used the data set given in the original post. I don't know if the ID given was "artificial" or not. That said, if I was trying to plot something that should be unique, I would use a unique ID. If there wasn't a unique ID from my source, then I would assign a unique ID, probably with recno() during the load.

I'm not sure what you mean by the control of the different shapes. You mean the big X I used for each data point? The symbol(s) used are controlled by Chart Properties -> Style -> Look, and the size by Chart Properties -> Presentation -> Representation -> Symbol Size. Did you want more control still, like assigning a particular symbol to a particular category of data?