Assign a number to each unit, and then randomly move away from that number within a narrow band using the rand() function. In one of my charts, for instance, I'm using "Current Event" where you have the units. I believe it's defined with a dual() function so that it has a numeric value. Then I do this as the dimension in the chart:
dual("Current Event",35-(min("Event #")-.6*rand()-.15))
In a different application, it looks like I decided to randomize in the script, probably for better performance on a large data set, and perhaps to keep data points from moving around randomly every time the chart redraws itself. Here's what looks like the relevant portion of the script. I have various types of equipment, and I want to plot data points for this equipment in bands rather than in a line.
MAPPING LOAD *
Equipment Type,Equipment Type Sequence
,dual([Equipment Type] & ' ' & [Inspection Item]
,8-(applymap('Equipment Type',[Equipment Type])-.8*rand()-.12)) as [Plot Item]
FROM Inspection.qvd (QVD)
So now in this case, I use the [Plot Item] field instead of the [Equipment Type] field. If you have a lot of data points, I also recommend using the argb() function for transparent colors.
The other problem is that QlikView will want to plot your data points as numbers. To get around this, I've actually created a text object with the legends that I want and put it on top of the numbers, and made certain that the axis was fixed so that it always matched my text.
It's trivial in QlikView to assign a number to each value without using an inline load (recno() for distinct values for instance), so you could randomize the bubble display for 250+ items fairly easily. The problem is that QlikView will display the number instead of the item. My text object solution to that problem isn't going to help for 250+ items. There may be a workaround, but I don't know of one.
Ideally such information is best displayed in a bar chart. A scatter diagram is 3-dimensional and requires two dimensions for an item. For example the items (Tractor & Scooter etc) need more than the one dimension of quantity - it may be color or type or whatever. Otherwise what JW has suggested can be done. If you do not want to load inline you may add another field of 'Item Nos' which automaically gets the next number when an item is added. This is easy to do in the excel spreadsheet. However the x axis in the chart will still show the serial numbers.
See the attached. I'm showing inventory age by location. Every plot point is an item in a location. Each location has its own "swim lane" for the inventory data to appear in. Scatter charts like this make it easy to see patterns in the data. You can mouse over any particular point to see its details, or click to select it. Say you see a group of aged inventory and want to understand what it is and why it's so old. Drag a box around the group and go look at the details for the items in that group.
The other way I can see displaying this is also on the tab, which is sparklines for the number of items by inventory age range. But I think the patterns are less apparent that way, and that it is harder to then explore any patterns that you DO see.
How would you even display this data with a bar chart? Well, I mean other than using a bar chart in place of each sparkline. That's certainly doable, but I don't think is any better than the sparklines.
We may have just interpreted the question differently. The attached was my interpretation. What's yours?
testBarPlot.qvw 200.8 K
Unfortunately I can't open your attachment due to 'personal edition' limitation. But I do get your point. I also think we have interpreted the Q differently. How I saw it was that there were only two dimensions to the data given - items and numbers. For that situation the Bars give you the adequate visuals. In your example, if you had only the age of inventory items to show, a bar chart will do the job and a scatter will not add anything. Having another characteristic of the items (location) gives the option (definitely better one) of using the scatter diagram. If there was one more characteristic , say floor figure, I presume a bubble diagram would suit better -I have not tried it though. I think it is important to know what kind of data we have and which chart will suit it best. Hope this clarifies mycomment earlier. Darshan
I suspect you're visualizing what I did correctly. But just for clarity, here's what I was building:
And here's the script:
'Location ' & chr(ord('A')+recno()-1) as Location
,recno() as Sequence
,dual('Item ' & ID & ' in ' & Location
,10-(applymap('Locations',Location)-.8*rand()-.12)) as "Plot ID"
,class(Age,1) as "Age Class"
recno() as ID
,'Location ' & chr(ord('A')+floor(rand()*10)) as Location
,rand()*2+if(rand()>.4,0,rand()*5+if(rand()>.2,0,rand()*10+if(rand()>.1,0,rand()*20))) as Age
Thanks for the details. I ran the script and could replicate your chart as below. However for some reason I do not get the Locations A, B etc. along Y axis – wonder what simple step I am missing out.
Darshan Bhatt, MD, M.Phil.
Consultant: Patient Safety & Pharmacovigilance
image003.png 44.2 K
You're not missing a simple step, and that's a weakness of the approach. As I said earlier:
"The... problem is that QlikView will want to plot your data points as numbers. To get around this, I've actually created a text object with the legends that I want and put it on top of the numbers, and made certain that the axis was fixed so that it always matched my text."
And with large numbers of values, I recommend using argb() in the background color expression for the first expression so that single points are very light, but multiple points in the same area build up a more solid color. In one chart, I even let the user select the transparency value to better match the number of points currently being displayed. In that chart, I noticed that different patterns were visible at different transparency values.
first of all, I think that this is a really cool example on how you can extend QlikViews possibilites to generate new kinds of data visualization.
I really learned a lot, thanks for sharing.
Leaving all technical stuff behind, I remember two of your statements:
"But I think the patterns are less apparent that way, and that it is harder to then explore any patterns that you DO see."
I think this is a really interesting questions and would like to ask you if you could share any more insight into your belief.
As I understood, you have used that kind of visualization quite often, and I assume that your users are quite happy with that solution.
Though I've only spent only a short time with your demo app, I am personally (I emphasize this, it's just my subjective temporary point of view) not quite convinced that the scatter chart solution
is superior to the spark line / line chart with classes.
I think one problem of the scatter chart is that the randomly distributed data points across the swimming lane produce also random visual cluster.
Then you mentioned yourself that you might see different patterns depending on transparency (already set points are covered by new ones), while the spark line is quite clear about the count of data points within the cluster.
I think the spark line maybe has some disadvantages if you don't choose an appropriate class width, so you might not see a pattern if the pattern scale is smaller than /range of the class width.
Also you said using the spark lines makes it harder to further explore the patterns, I assume by selecting a range of points?
Is this not more depending on the real estate you spend both visualizations?
I think we often focus too much on pure technical solutions or problems, so I would really appreciate if you could share some of your thoughts from a usability point of view pro/con the scatter solution or may be even an example when a scatter plot enabled you to detect a pattern while a spark line had not.
Just my take on this, being a scatter chart enthusiast myself (that is a great example John, thanks, will certaintly "borrow" it) I see one very superior advantage in using a scatter chart, in QlikView, over sparklines, bar charts, box plots, etc. It's that you can take advantage of QlikView's interactivity and actually go and select the oldest stocks in the graph, the not so old, etc.
You can then list them in detail and show all extra information that will help someone make a decision over each of those stocks. It makes a real impact in demos and presentations also.
Also, something else that you could be showing in a scatter chart is stock value, using bubble size for example.
Attached is an example of the difference between a random scatter and a line chart using about the same screen real-estate. To me, the scatter chart is much more visceral. I comprehend it immediately, intuitively. The pattern is obvious. The repetitiveness of the pattern, even though it's not entirely repetitive, is obvious. For me, it takes a more thorough study of the line chart to perceive the same patterns in it.
Other information, though, is only available in the line chart. I can't even imagine the total numbers per day looking at the scatter chart, and the line chart gives an easy approximation, and you can mouse over for the exact totals. There are some small scale variances that I can ONLY detect in the line chart, and they're OBVIOUS in the line chart. For example, the dip on 1/16/2011 is invisible in the scatter chart but impossible to miss in the line chart. I'm sure there are other things.
As always, it's a matter of what sort of information you're trying to display, what you're trying to get your users to comprehend, to explore. I'd say that line charts are most appropriate most of the time. But I do think a random scatter has its place.
I've probably only done the random scatter a few times in live applications. And now that I'm thinking about the scatter chart with the variable transparency, I remember that it is NOT randomized, but rather a normal scatter chart with two continuous dimensions.
I suppose I should just include a picture of the charts. Faster than downloading, and personal edition friendly. The application is still attached for people who want to see more details.
As far as the spark line approach and further exploration, you can't pick a dimension value on the spark line. But I bet with some work you could get an actual line chart to do something similar, and thus allow you to select points. It's probably no worse than getting a scatter chart to do what it's doing in the earlier example.
testScatter3.qvw 155.0 K