Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Smoothing a Line Graph

Hello,

I am looking to map out several customers' credit scores on a line graph. The credit score will be on the x axis and the count of customers will be on the y axis. Since there are so many possible credit scores, the line graph looks very jagged. I was able to make it look smoother by rounding all of the credit scores to the nearest 10th, so if the score is 778 it rounds to 780. Although this made the graph look the way I needed it to, the values on the y axis were inflated because of more customers falling into each rounded bucket. Is there a way for me to replicate what I did by rounding while keeping the y axis the same as before rounding?

Thanks

8 Replies

Re: Smoothing a Line Graph

Matther,

Can you please share the sample aplication.

Life is so rich, and we need to respect to the life !!!
effinty2112
Honored Contributor

Re: Smoothing a Line Graph

Hi Matthew,

                         Suggest you look at the Class function. This allows you to group your credit scores into fixed width classes or bins. Your dimension would be a calculated dimension something like:

Class([Credit Score],10)

This would group the credit scores into 'bins'

0<Credit Score <=10

10<Credit Score <=20

etc.

In this case 10 is the width of your bin which might be sensible if your scores run from 0 to 100, not so good if they run from 0 to 1.

Your expression could be something like Count(CustID).

Good luck

Andrew

Not applicable

Re: Smoothing a Line Graph

This works, but it still increases the y axis. Is there a way to keep the y axis the same as it would be before placing the values into classes?

effinty2112
Honored Contributor

Re: Smoothing a Line Graph

Hi Matthew,

If the chart is telling the truth then we must have some respect for what it shows us. However here are a couple of suggestions:


You can increase the size of the classes, that should help to even out the peaks and troughs.


If you think the users would be able to properly interpret it in the Axes tab of the chart you could change your expression axis to a Log Scale and check the Show Grid option. That will make the highs and lows look less extreme but your audience will need to be made clear that the scale is not linear - a bar twice the height of another represents a ratio of 10:1.

Cheers

Andrew

Re: Smoothing a Line Graph

Try checking "Continuous" property on the Axis pane.

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

Re: Smoothing a Line Graph

Hi,

you could try with a moving average using a RangeAvg(Above(...)) expression.

This should neither change the number of dimension values nor the expression axis while smoothing the line graph.

see also: RangeAvg ‒ QlikView

hope this helps

regards

Marco

MVP
MVP

Re: Smoothing a Line Graph

Divide the result by 10? Or whatever you use as your class width.

MVP
MVP

Re: Smoothing a Line Graph

Here's an application with random sample data and the various approaches that have been suggested and one more. Sample data for anyone else that wants to play.

Edit: Oh, and don't use the "accumulate 20 steps back, divide by 20" that I added. It pushes the curve to the right, thus inflating the average credit score.

Community Browser