How do I change CFCHART title font?
I am using the WebCharts3D interface to create and modify charts, and then using the generated XML style as an in-line style in my Coldfusion code.
So this shows up correctly in the WebCharts3D:
<?xml version="1.0" encoding="UTF-8"?> <pieChart depth="Double" style="Solid"> <title font="Arial-18-bold"> <decoration style="None"/>This is a title </title> </pieChart>
This simply shows the example title with no box around it, and set to the desired font size and weight. You can take this code, copy it into the WebCharts "XML Style" window, apply it, and see that it works.
I use this in my Coldfusion code like this:
<cfsavecontent variable="piecontent"> <?xml version="1.0" encoding="UTF-8"?> <pieChart depth="Double" style="Solid"> <title font="Arial-18-bold"> <decoration style="None"/>This is a title </title> </pieChart> </cfsavecontent> <cfchart name="mychart" format="png" style="#piecontent#"> <cfchartseries type= "pie"> <cfchartdata item="sample1" value="10"> <cfchartdata item="sample2" value="20"> </cfchartseries> </cfchart>
The title correctly has "decoration" set to "none", because there is no box around it, but the title font size and weight is totally ignored. Is this a bug? Is there a workaround?
EDIT: It appears that this problem of ignored font size and weight is ALSO true for the overall font, like if you put this: <pieChart depth="Double" style="Solid" font="Arial-16-Bold">.
It seems like those particular settings are ignored in favor of the cfchart tag's font attributes. Try using those instead:
<cfchart format="png" font="Arial" fontBold="true" fontSize="18">
EDIT: While the above works with pie charts (only), it seems like another bug... What does work is interfacing with webcharts directly. It is more involved, but offers complete control over chart settings.