How do I change CFCHART title font? - coldfusion

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.

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.

Related

Qt5 custom widget - Curved slider

I'm starting my next electronics project which is to create my own version of Google's Nest Thermostat. I like the whole circular dial for temperature selection and I've been having a think about how to create this myself. GUI programming is not my area of expertise (CLI all the way!).
So far I'm think along one of two lines, both involving custom widgets:
Create a widget that inherits from the pushbutton class. This subclass will contain lots of buttons, one for each step in the temperature scale, arranged in a 3/4 circle.
Create a widget that inherits from the slider class, defining an object that is curved around 3/4 of a circle. Each step is a temperature.
Now... I have no idea if these are practical solutions to this problem or if there is a much easier way of doing this. I've had a look at the style sheets and I don't THINK that is going to do it. I've had a root around Google for anything similar and not found anything yet; that said, AnalogWidgets from 3electrons at least creates dials, but these are for output rather than input.
I tried this out yesterday and it works rather nicely if you want to simulate the nest thermostat in an app this includes the js and SVG image:
https://www.svidget.io/examples/nestthermostat
HTML snippet:
<object id="nestThermostatWidget" role="svidget" data="nestThermostatWidget.svg" type="image/svg+xml" width="400" height="400">
<param name="targetTemp" value="77" />
<param name="ambientTemp" value="80" />
<param name="unit" value="F" />
<param name="state" value="cooling" />
<param name="showLeaf" value="1" />
<param name="awayMode" value="0" />
</object>

ColdFusion CFCHART Pie Chart Data Label Position

I have created a pie chart using the cfchart tag and as of the moment the labels for the chart data show outside of the pie chart, where I would like them placed inside each respective slice. I've looked through CF documentation but can seem to find a easy way to accomplish this. Can anyone shed some light on how I can just make the labels show inside each slice of the pie rather than outside?
Thank you!!!
I've tried using the following code and then using the cxml variable as the value for the style attribute on the cfchart tag. This does indeed set the labels inside the slices, but it also makes the pie chart have an odd shading to it. In addition, before applying this style I can set a value for the url parameter of the cfchart tag and cause a javascript function to fire when each slice is clicked. With the style applied, it's like it breaks each slice into separate clickable areas.
<cfsavecontent variable="cxml">
<?xml version="1.0" encoding="UTF-8"?>
<pieChart depth="Plain" style="Solid" is3D="false">
<dataLabels style="value" placement="Inside" foreground="white" font="Arial-12"/>
</pieChart>
</cfsavecontent>
<cfchart format="png" style="#cxml#"....>
Using the WebCharts3D application that ships with ColdFusion 8, I was able to copy the XML.
The following is what worked for me:
<cfsavecontent variable="cxml">
<?xml version="1.0" encoding="UTF-8"?>
<pieChart depth="Plain" style="Solid" is3D="false">
<legend spacing="0" placement="Right" font="Dialog-11">
<decoration style="None" />
</legend>
<paint palette="PastelTransluent" paint="Plain" min="44" max="95"/>
</pieChart>
</cfsavecontent>

cfchart tooltip popup format?

Would anyone know if it is possible to format the tooltip that displays when hovering over a ColdFusion chart (when the attribute tipStyle = "MouseOver" is set)?
I would like it to be formatted as a number style to include two decimal places, even if the value is 0 (ex: 0.00 instead of just 0). I believe this value ties into the axis data format as well, so if it would be at all possible to format the axis numbers, then it might carry over to the tooltip.
I had been thinking to try and override the javascript function call for the onmouseover event that is built into the cfchart tag, but I am not sure the name of this functionor how to go about doing that either. Any thoughts/suggestions would be great. Thanks.
You could customize the annotation (ie tooltip). Just specify a custom format ie ${value;##.00} to display two decimal places.
For a list of the supported variables see the webcharts3D utility help: Designer => Design => Elements =>Parameters.
<cfsavecontent variable="style"><?xml version="1.0" encoding="UTF-8"?>
<frameChart>
<frame xDepth="12" yDepth="11"/>
<yAxis scaleMin="0" />
<elements drawShadow="true">
<morph morph="Grow"/>
<![CDATA[
X Label = $(colLabel)
X Value = ${value;##.00}
]]>
</elements>
<decoration style="FrameTopBottom" foreColor="white"/>
<paint palette="Pastel" isVertical="true" min="47" max="83"/>
<insets right="5"/>
</frameChart></cfsavecontent>
<cfchart format="png" style="#style#">
<cfchartseries type="bar">
<cfchartdata item="Apple" value="50">
<cfchartdata item="Orange" value="76.8">
<cfchartdata item="Pear" value="100.634">
</cfchartseries>
</cfchart>
Just as a note I don't think you could intercept cfchart's onmouseover event in Javascript easily because cfchart uses Flash or static images, so you'd have to do some sort of funky ActionScript <-> Javascript wizardry to intercept the event.

CFchart shut down accidently my laptop

In these days, I've got the problem about CFChart in my laptop. Because whenever I run (open) CFChart in my latop, which accidently shut down and come out Blue Screen like memory leaking.
PS: Oracle 10g and CF8 are the same installed in this latop as well.
Now, I've found why my laptop is shut down once I run my coding. It's because of the following coding and I've saved as "style.cfm" and include it in my chart file.
<cfsavecontent variable="theme">
<?xml version="1.0" encoding="UTF-8"?>
<pieChart depth="Double" style="Solid" type="SmallNut" angle="0">
<dataLabels style="Pattern" placement="outside" autoControl="false" font="Arial-10">
<![CDATA[
$(colPercent)
]]>
</dataLabels>
<legend spacing="0" placement="Right" halign="Right">
<decoration style="None"/>
</legend>
<elements drawOutline="false">
<morph morph="Grow"/>
</elements>
<table>
<heatmap isEnabled="false" minLevel="0.0" maxLevel="0.0"/>
</table>
<popup background="white" foreground="black"/>
<decoration foreColor="#B200B2"/>
<paint palette="Pastel" paint="plain"/>
</pieChart>
<cfsavecontent>
So, I've removed and saved as xml file. Then, 100% working after rendering it again. I cannot convince why my laptop only shut down once for above coding.

Evernote export format (ENEX) to HTML, including pictures?

#Solved
The two subquestions I have created have been solved (yay for splitting this one up!), so this one is solved. I'll award the check mark to samjudson, since his answer was the closest. For actual working solutions though, see the below subquestions; both my implemented solutions and the checked answers.
#Deprecated
I am splitting this question into two separate questions, since this is a fairly complicated problem. Answers are still welcome though.
The suquestions are:
XSLT: Convert base64 data into
image files
XSLT: Obtaining or matching hashes
for base64 encoded data
Hi, just wondering if anyone here has had any success in converting Evernote's export format, which is XML, to HTML including the pictures. I do know that Evernote has an export to HTML function which does this, but I eventually want to do more fancy stuff with it.
I have managed to accomplish getting the text only using the following XSLT:
Sample code removed
See child questions for implemented solutions.
However, a.t.m. this simply ignores any pictures, and this is where I need help.
Stumbling block #1: Evernote stores its pictures as GIFs or PNGs, and when exported, it embeds these GIFs & PNGs directly in the XML using what appears to be base64 (I could be wrong). I need to be able to reconsitute the pictures. If you open the file in a text editor, look for the huge blocks of data in the **//note/resource/data**. For example (indents added manually):
<resource>
<data encoding="base64">
R0lGODlhEAAQAPMAMcDAwP/crv/erbigfVdLOyslHQAAAAECAwECAwECAwECAwECAwECAwECAwEC
AwECAyH/C01TT0ZGSUNFOS4wGAAAAAxtc09QTVNPRkZJQ0U5LjAHgfNAGQAh/wtNU09GRklDRTku
MBUAAAAJcEhZcwAACxMAAAsTAQCanBgAIf8LTVNPRkZJQ0U5LjATAAAAB3RJTUUH1AkWBTYSQXe8
fQAh+QQBAAAAACwAAAAAEAAQAAADSQhgpv7OlDGYstCIMqsZAXYJJEdRQRWRrHk2I9t28CLfX63d
ZEXovJ7htwr6dIQB7/hgJGXMzFApOBYgl6n1il0Mv5xuhBEGJAAAOw==
</data>
<mime>image/gif</mime>
<resource-attributes>
<file-name>clip_image001.gif</file-name>
</resource-attributes>
</resource>
Stumbling block #2: Evernote stores the file names of each picture under the resource node
**//note/resource/resource-attributes/file-name**
however, in the actual note in which it refers to the picture, it references the picture not by the filename, but by its hash, for example:
<en-media hash="4aaafc3e14314027bb1d89cf7d59a06c" type="image/gif" border="0" width="16" height="16" alt="Alt Text"/>
Can anyone shed some light on how to deal with (base64) encoded binary data inside XML?
Edit
I understand from the comments & answers that plain ol' XSLT won't get the job done handling images. The XSLT processor I am using is Xalan , however, if this is not good enough for the purposes of image processing or base64, then I am please suggest one that does do these!
Also, as requested, here is a sample Evernote export file. The code clips above are merely selected parts of this. I have stripped it down such that it contains just one note and edited most of the text out of it, and added indents for clarity.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE en-export SYSTEM "http://xml.evernote.com/pub/evernote-export.dtd">
<en-export export-date="20091029T063411Z" application="Evernote/Windows" version="3.0">
<note>
<title>A title here</title>
<content><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">
<en-note bgcolor="#FFFFFF">
<p>Some text here (followed by the picture)
<p><en-media hash="4aaafc3e14314027bb1d89cf7d59a06c" type="image/gif" border="0" width="16" height="16" alt="A picture"/></p>
<p>Some more text here (preceded by the picture)
</en-note>
]]></content>
<created>20090925T063154Z</created>
<note-attributes>
<author/>
</note-attributes>
<resource>
<data encoding="base64">
R0lGODlhEAAQAPMAMcDAwP/crv/erbigfVdLOyslHQAAAAECAwECAwECAwECAwECAwECAwECAwEC
AwECAyH/C01TT0ZGSUNFOS4wGAAAAAxtc09QTVNPRkZJQ0U5LjAHgfNAGQAh/wtNU09GRklDRTku
MBUAAAAJcEhZcwAACxMAAAsTAQCanBgAIf8LTVNPRkZJQ0U5LjATAAAAB3RJTUUH1AkWBTYSQXe8
fQAh+QQBAAAAACwAAAAAEAAQAAADSQhgpv7OlDGYstCIMqsZAXYJJEdRQRWRrHk2I9t28CLfX63d
ZEXovJ7htwr6dIQB7/hgJGXMzFApOBYgl6n1il0Mv5xuhBEGJAAAOw==
</data>
<mime>image/gif</mime>
<resource-attributes>
<file-name>clip_image001.gif</file-name>
</resource-attributes>
</resource>
</note>
</en-export>
And this needs to be transformed into this:
<html>
<body>
<p>Some text here (followed by the picture)
<p><img src="clip_image001.gif" border="0" width="16" height="16" alt="A picture"/></p>
<p>Some more text here (preceded by the picture)
</body>
</html>
With the file clip_image001.gif being generated and saved.
There is a new Data URI specification http://en.wikipedia.org/wiki/Data_URI_scheme which may be of some help provided you are only intending to support modern browsers, and your images are small (for example IE8 only support <32k images).
Other than that the only other thing you can do is use some external scripts to export the image data to file and use them. This would depend greatly on what XSLT processor you are using.
It exists a pure XSLT answer to this issue ; look at this page