Copy link to clipboard
Copied
I am using ColdFusion8 and I am creating a report with numerous charts and graphs with WebCharts.
The problem I am having is with pie charts. I want to be able to adjust items like the label styles.
With the bar graphs, I am simply creating the graph with WebCharts, saving the xml, and calling it in the cfchart tag (styles = "test"). No problems.
However, with pie graphs I get a "Text Outside XML:" error.
Even if I just copy the default pie xml (default_pie.xml) , rename it, and then try to call in the cfchart tag, it gives me the same error.
Any help would be appreciated.
Copy link to clipboard
Copied
calling it in the cfchart tag (styles = "test")
If that is the literal code, you are missing pound signs around the #test# variable. So the charting engine thinks the xml is the word "test".
Copy link to clipboard
Copied
test is the name of the xml file. (test.xml)
This works for a bar graph. You will see I have style="Veggies". The name of the xml file I am using for that bar chart is called Veggies.xml. I have 6 bar charts using 6 different xml files working this way with no problem :
| <cfchart | ||||
| format="png" | ||||
| xaxistitle="" | ||||
| yaxistitle="Participating Residents" | ||||
| chartheight="500" | ||||
| chartwidth="600" | ||||
| scalefrom="0" | ||||
| scaleto="#commVeggies.recordcount#" | ||||
| font="arial" | ||||
| fontsize="16" | ||||
| xoffset="0.05" yoffset="0.05" | ||||
| show3d = "no" | ||||
| fontBold ="yes" | ||||
| style="Veggies" | ||||
| > |
But the same format does NOT work for pie chart. I get the Text Outside XML error:
<cfchart
pieslicestyle="sliced"
format="png"
chartHeight = "400"
chartWidth = "600"
font="Arial"
showborder="no"
show3d="yes"
yAxisTitle = "Test X Axis"
style="test"
>
Copy link to clipboard
Copied
test is the name of the xml file. (test.xml)
I am not sure how CF would know it is an xml file without a path or extension. Like I mentioned, it is just going to assume the xml is literally the word "test". At the very least you need to supply the *.xml extension.
Copy link to clipboard
Copied
At the very least you need to supply the *.xml extension.
That is assuming your xml file resides in the same directory as your *.cfm script. Otherwise, you need to supply the full path
<cfchart style="/path/to/test.xml"
Copy link to clipboard
Copied
tmfprogrammer wrote:
test is the name of the xml file. (test.xml)
This works for a bar graph. You will see I have style="Veggies". The name of the xml file I am using for that bar chart is called Veggies.xml. I have 6 bar charts using 6 different xml files working this way with no problem :
<cfchart format="png" xaxistitle="" yaxistitle="Participating Residents" chartheight="500" chartwidth="600" scalefrom="0" scaleto="#commVeggies.recordcount#" font="arial" fontsize="16" xoffset="0.05" yoffset="0.05" show3d = "no" fontBold ="yes" style="Veggies" > But the same format does NOT work for pie chart. I get the Text Outside XML error:
<cfchart
pieslicestyle="sliced"
format="png"
chartHeight = "400"
chartWidth = "600"
font="Arial"
showborder="no"
show3d="yes"
yAxisTitle = "Test X Axis"
style="test"
>
However, verify that:
1) the content of the xml file starts with <?xml version="1.0" encoding="UTF-8"?>. (There should not even be a space between the beginning of the page and that line);
2) the XML file is in the same directory as the page generating the chart;
3) the chart style in the XML follows the built-in format used by the webcharts engine, when you use style="nameOfFile". Otherwise, use style="nameOfFile.xml".
Another thought: it might be a good idea to include pieslicestyle, format, chartHeight, chartWidth, font,... etc. as elements within the XML style file.
Copy link to clipboard
Copied
-==cfSearching==- wrote:
calling it in the cfchart tag (styles = "test")
If that is the literal code, you are missing pound signs around the #test# variable. So the charting engine thinks the xml is the word "test".
The new rules for cfchart allow you to simply use the name(without extension) of the XML file. Crazy, but it's true.
Copy link to clipboard
Copied
The new rules for cfchart allow you to simply use the name(without extension) of the XML file. Crazy, but it's true
Maybe it should (though that sounds odd). But it did not behave that way for me. Unless I supplied an extension (or full path), the result was same invalid xml error. Add an *.xml extension, or read the file contents into a variable, and it works fine. So apparently the charting engine is not having a problem with the content, just the file path. The Text Outside XML message may just be a red herring. But it is an easy fix, just add a file extension and it should work fine.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now