Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Creating 'dashed' lines between points

robsuddaby
7 - Meteor

I'm creating goal build-up charts in Tableau and have encountered one issue with the data that I can't quite work out how to overcome.

 

I've got a number of rows for each part of the build up, representing the players and their involvement in the goal. Currently my data has the position from where they play a pass/cross or take a shot in the form of start position x and y and end position x and y. I've split the two parts and stacked on top of each other and created a path so that I can draw the lines, as seen below.

 

The issue I have is that after receiving a pass, some players move with the ball before passing it on and this isn't captured in the data. I can get round this by calculating a rolling path id for each of the points to connect all of them (i.e. point 1 is path 1, point 5 is path 5 and so on) but the visualisation is confusing and I'd like to be able to better draw attention to the players movement. 

 

The way I thought of to get round this is to draw lines between the previous XY and the new XY and then split them into numerous lines to create a dashed line effect. However, I can't work out how I would be able to do this, as it would involve creating new rows and inserting them between the existing rows.

 

Does anyone have any ideas about the best approach for 1) creating these additional rows and 2) splitting the newly created lines? Much obliged!

 

 With Dotted Lines.png

14 REPLIES 14
DataBlender
11 - Bolide

Hi @robsuddaby, interesting visualisation!


Do you have any sample data that you could share?

robsuddaby
7 - Meteor

Thanks! Yes of course, apologies I should have included in the first place. Let me know if it isn't clear.

 

Event IDPlayer IDXYPath
12425.436.31
2123638.21
21235.353.72
32935.353.71
32946.365.42
4175968.11
41783.581.72
5784.381.51
61290.758.21
61210051.12
DataBlender
11 - Bolide

Hi @robsuddaby

 

I've attached a workflow of how you might go about creating the new legs for each event. I've also introduced a new field to act as a flag for when the player is dribbling. My initial thought was that this could be the dimension to use as colour in Tableau.

 

However, I actually think that this is a query to be solved within Tableau rather than Alteryx as I don't think you can colour (or display as dotted) the pathlines according to a dimension in Tableau? Therefore, the output of my workflow above will give you a continuous line in Tableau, but you won't be able to distinguish between dribbles and passes.

 

A quick bit of research led me to Jonathan Drummey's blog post on drawing dotted lines.. you may wish to take a look there and following the padding technique in Tableau.

 

In any event I'm interested to hear other people's thoughts on the matter and also how you proceed!

robsuddaby
7 - Meteor

Thank you very much for that, just trying to work out how you've done what you've done but I think this may work... there's some unnecessary rows where the x and y are the same as the following row but I think I can now use this to draw the lines in Alteryx and then where the flag exists, try to break the line into several pieces. Do you think that's possible?

 

Unfortunately I don't think doing this in Tableau is realistic, primarlily because it requires dual axis and I need the second axis (nevermind not really udnerstanding how Jonathan or Bora Beran have done it!)

KaneG
Alteryx Alumni (Retired)

Hi @robsuddaby,

 

@DataBlender is on the right track, however the dribble portion would have to be a dataline for start point and a dataline for end point, so then it is it's own segment. It you then wanted it to be dotted, you could break that segment up into 10-15 smaller segments and then drop every second one.

 

In order to break it into smaller segments, I find it is sometimes easiest to work out Max(X)-Min(X)/(Number of Segments) and then use a generate rows, same for Y.

 

Kane

DataBlender
11 - Bolide

Hi @robsuddaby@KaneG's approach is a good one and matched the workflow that I've created to generate the new points.

 

These get generated as dotted lines in Tableau:

footballpath.png

 

 

robsuddaby
7 - Meteor

See below!

robsuddaby
7 - Meteor

@KaneG @DataBlender, thank you both so much! I really appreciate your help in figuring this out, I'm still trying to understand exactly what you've done but the theory all makes sense to me. Just one question if I may, I'm getting some issues with one match in particular, where the Generate Rows tools are both saying 'Error: The value did not change after the Loop Expression' and I can't work out what is causing the issue. Would you be so kind as to have a quick look, the new data is attached. Many thanks!

 

DataBlender
11 - Bolide

Hi @robsuddaby, the issue is caused by some instances where the increment to be added is 0, i.e. where the X or Y coordinate doesn't need to be changed. Because the increment is 0, it thinks it would never reach the end of the loop.

 

An example of this is for the score of 0-3, between events 1 and 2.

 

Since the join immediately after the generate rows is joining by position, we currently have to generate the same number of rows for both the x and the y outputs of the generate rows.

 

Don't have much time to think of a solution at the moment but will try tomorrow unless @KaneG has any bright ideas?

Labels