3

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">.

TheGerm
  • 481
  • 1
  • 4
  • 18

2 Answers2

4

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.

Leigh
  • 28,765
  • 10
  • 55
  • 103
  • But this will change the font for EVERYTHING on the chart, right? Including the labels? I'm just trying to change the font for the title. – TheGerm Aug 21 '12 at 21:32
  • No, it just affects the title. – Leigh Aug 21 '12 at 23:52
  • To clarify, it only affects the title for this specific chart type. Though I think the original issue may be a bug. – Leigh Aug 22 '12 at 00:31
  • Okay, I see what you mean. It works for a pie chart but NOT for a bar chart. Argh! I'm actually intending to show a bar AND pie chart at the same time, so the difference in font is pretty glaring. Okay, is there any way to change/override just the label font and weight for a chart? (Especially a bar chart) – TheGerm Aug 24 '12 at 15:18
  • 1
    If there is, I do not know it. The more I played around with it, I think it is just a bug. You could always [interface with webcharts directly as shown here](http://www.raymondcamden.com/index.cfm/2008/1/18/Coolest-CFCHART-Trick-Ever). That *does* work. Though it is a bit more work than a cfchart - just to set the title font. – Leigh Aug 24 '12 at 18:05
  • WHOA! That link is fantastic. I'm already mocking it up in webcharts to get the XML style, so I don't even need to extract it from the wcp file (as he is doing). I would love to just plug it into a java object and get exactly what I'm seeing in the mockup. Could you write this little blurb as an answer so that I can mark it as accepted? – TheGerm Aug 24 '12 at 19:07
  • 1
    Yep, that post is "an oldie but a goodie" :) Since my response was pretty short, I just added the blurb as an edit. Hope that is cool. – Leigh Aug 24 '12 at 19:22
0

My experience, though I can't find any proof online other than my own testing, is that ColdFusion's implementation of Webcharts does not support styling the title.

Dan Short
  • 9,598
  • 2
  • 28
  • 53