This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
I am trying to plot a very basic line chart using charting tool. I have an output from a cross-tab tool. I need to plot first column on X-axis and all remaining column on Y-axis. Problem is that number of columns and column titles are not fixed. They can keep changing. The chart tool fails to generate desired graph - it ignore new column and columns for which header/title are new. Can someone help? I am looking to solve this issue specifically in version 11.7.4.
I can't think of a very elegant solution to this, but here's a suggestion:
Read in your data without field names in a structure where the first column is the X axis value and Field2, Field3 etc. are the values you want to see on the Y axis (i.e. your lines).
Add and correctly name enough columns to cover the maximum possible extent of the data (e.g. up to 20 fields).
Create a chart and add all 20 fields as layers. Many of these will be blank so no line will show.
Hide the legend
When new data flows in as long as it comes into one of your preconfigured field names 'Field4, Field5, etc.' it will be plotted on the chart.
Use another method to build a legend that accurately labels the data, for only the rows that have genuine values. You would change Field1, Field2, etc. for the actual field names. This would need to be created as a separate object, possibly as a table. You'll have some work to do to match up the colours but hopefully they would be assigned in a default order you can replicate.
Use a layout tool to place your legend next to the chart.
As I said, it's not very elegant, but that's the only approach I can think of. You might be able to do something using a macro and overlaying the PNGs outside of Alteryx but I'm not sure about that.
Thanks a lot for the quick and creative reply. It did work.
I imported original data with 'first row contains data' setting. So, after import, my first data row was actually the header. I then used sampling tool to divide it into two parts; first sampling tool pulls first row (which are actually the headers) and second sampling tool pulls remaining rows. I create table from the output of first sampling tool and use it as legend. I use line chart to plot output of second sampling tool. At last, as you suggested, I used layout tool to place them side-by-side.
In my case, maximum fields I expect is only 5. So, I was able to implement it without much trouble.