ColdFusion CFCHART Pie Chart Data Label Position - coldfusion

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>

Related

XSLT Display CHECKBOX

I have a report in XML that is formatted using xslt. I need to display a checkbox next to some text. Currently this is the xslt
<TableHeaderRow>
<TableHeaderCell colspan="4">
<TableCommentsText>
☐ <xsl:value-of select="/ReportForm/Comments1/Paragraph/#Text" />
</TableCommentsText>
</TableHeaderCell>
</TableHeaderRow>
This is not working. My output comes out blank before the text. If I use &# 174; (®) it's working fine.
What can I do to get the CheckBox?
Thanks.

Over-riding DRI Templates using xsl in DSpace

I'm working with DSpace 4.2 xmlui Mirage theme. I want to hide the Communities and Collections from the search results page.
By inspecting the DRI document of the page I found that the Communities and Collections results are added as:
<list id="aspect.discovery.SimpleSearch.list.comm-coll-result-list" n="comm-coll-result-list">
So I tried over-riding the template in the xsl file of the theme.
<xsl:template match="dri:list[#id='aspect.discovery.SimpleSearch.list.comm-coll-result-list']">
<!-- Over ride / remove the recent submissions box-->
</xsl:template>
But no change is reflected in the page. Am I doing something wrong here? I was able to hide the default search box in a similar manner by over-riding the template generating it's corresponding div.I noticed that the list item I want to hide is contained within another div. Is is not possible to over-ride a DRI element unless its tag is div?
You can also add a default filter query in your [dspace]/config/spring/api/discovery.xml.
Default filter queries are applied on all search operations & sidebarfacet clicks. One useful application of default filter queries is ensuring that all returned results are items. As a result, subcommunities and collections that are returned as results of the search operation, are filtered out.
Relevant lines here, note that this is disabled by default. Uncomment to make this work.
<property name="defaultFilterQueries">
<list>
<value>search.resourcetype:2</value>
</list>
Hope this help.
UPDATE
Copy the:
<property name="defaultFilterQueries">
<list>
<value>search.resourcetype:2</value>
</list>
<property>
in the <bean id="homepageConfiguration" class="org.dspace.discovery.configuration.DiscoveryConfiguration" scope="prototype"> because it overrides the defaultConfiguration as stated in this comment.
The collection and community list results are displayed by the following XSLT: https://github.com/DSpace/DSpace/blob/master/dspace-xmlui/src/main/webapp/themes/dri2xhtml/structural.xsl#L3616-L3635
To change the display via XSLT, try constructing your own template code.
<xsl:template name="collectionSummaryList">
<xsl:param name="handle"/>
<xsl:param name="externalMetadataUrl"/>
<xsl:variable name="metsDoc" select="document($externalMetadataUrl)"/>
...
</xsl:template>
If you completely suppress these results from your display, it will likely make your pagination counts unreliable. It might make more sense to suppress the community/collection results from the SOLR search results.

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

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.

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