I’ve got a basic pie chart with values like this
<cfchartdata item="January" value="503100">
<cfchartdata item="February" value="720310">
<cfchartdata item="March" value="688700">
I’d like to link each piece of the pie to a specific URL – I don’t need to post any variables to the URL.
I tried something like this;
<cfchartdata item="January" value="503100" url="januarydata.cfm">
but URL is not a valid attribute for ‘cfchartdata’
The
urlattribute belongs to the CFChart tag, not the CFChartData tagURL:
if you want to do a dynamic search you can use the dynamic values above mixed in with static and other CF values. for example:
In this example the $ITEMLABEL$ is converted to the label automatically.
Disclaimer
Before answering your actual question, I should point out that this isn’t a good practice and defeats the entire purpose of a dynamic website. You should consider a single page that accepts a parameter and pulls the data from a database depending on that parameter. For example
monthlyData.cfm?month=januaryThe simplest way would be to put the item label in the file name as you confirmed worked in the comments.
If you needed to do a little more testing before sending the user along, you could send them to a single ColdFusion page and use
CFSWITCH/CFCASEor good oldCFIF/CFELSEif there aren’t that many combinations.-or-
you could use the javaScript: option and run a function that uses window.location depending on the series clicked.
The js function may look like: