You will need to use custom styles for this. Macromedia experience design team has designed the various style files that are lying in the <cfusion-install>\charting\styles directory. If you want to modify the look and feel of the charts that you create you will need to create your own custom files by modifying these default style files and using the "style" attribute in the <cfchart> tag. I will demonstrate this by increasing the width of lines in line charts.
By default the style that is used for bar/line charts is - default.xml and the one for pie charts is - default_pie.xml.
Before applying the style file our chart looks like this
The corresponding code for this chart is:
<cfchart format="png"
scalefrom="-100" scaleTo="100" gridlines="5">
<cfchartseries type="line">
<cfchartdata item="Point1" value="-50">
<cfchartdata item="Point2" value="-25">
<cfchartdata item="Point3" value="1">
<cfchartdata item="Point4" value="25">
<cfchartdata item="Point5" value="50">
<cfchartdata item="Point6" value="75">
<cfchartdata item="Point7" value="99">
</cfchartseries>
</cfchart>
Creating your own style file.
(this is the style file you will get - mystyle.xml)
- Copy the default.xml file in <cfusion-install>\charting\styles directory to the directory where you have the .cfm of your line chart.
- Rename this "default.xml" to "mystyle.xml"
- For changing the line width the attribute that is used is "linewidth", in the <element> child tag of the xml document.
- Locate this line in the xml document:
<elements action="" shape="Area"
modify it to the following:
drawOutline="false"><elements action="" shape="Area"
drawOutline="false" lineWidth="6"> - Save the file, you have now created a custom style file.
Applying custom styles to charts
We will now apply the style file "mystyle.xml" we created above to our chart. This is very easy to do just use the "style" attribute in <cfchart> tag. Our code will now become:
<cfchart format="png"
scalefrom="-100" scaleTo="100" gridlines="5"
style="mystyle.xml">
<cfchartseries type="line">
<cfchartdata item="Point1" value="-50">
<cfchartdata item="Point2" value="-25">
<cfchartdata item="Point3" value="1">
<cfchartdata item="Point4" value="25">
<cfchartdata item="Point5" value="50">
<cfchartdata item="Point6" value="75">
<cfchartdata item="Point7" value="99">
</cfchartseries>
</cfchart>
and our graph will look like:

Comparison
Default line width

Line width = 6
41 comments:
Great Dude, we just want more like this, and more complex please aswell, thanks
Prayank,
I don't think this hotfix has actually resolved the problem. Take a look at:
http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=3&threadid=1029452&enterthread=y
The example only works for me if the cfchart tag style="mystyle" not style="mystyle.xml"
Some have wondered if you are working with/for Macromedia. Are you just a CF enthusiast? :-)
I've been working with macromedia since last November :-)
I've already mentioned this in my post about the features of the CF7 updater - Merrimack.
Cheers!
Prayank
Check CF documentations and I didnt see style attribute there. That should be an undocumented aspect, right?
The style attribute is a documented attribute of CF7 I think you looked up documentations of older version of coldfusion.
Also note that style="filename", so:
filename - "mystyle"
attribute - style="mystyle"
-------
filename - "mystyle.xml"
attribute - style="mystyle.xml"
Dont get confused please.
I love the look of the new CFChart and the ability to tweak to my hearts delight.
Having said that, I'm running into some obvious shortcomings:
1. No way to pass "id" values into cfchart to build a dynamic drill-down url.
2. No way to use error bars, even though they are supported in WebCharts.
The second item is a problem for a limited number of users, admittedly. However, the first item renders the ability to build a url for a data point completely useless. The URLColumn attribute in old cfgraph gave you the ability to do this...and now it's gone. That's too bad.
Is this type of customization or customization to the legend possible in CFMX 6.1? Please respond to cgsj_usa@yahoo.com Thanks.
Anyway via using the style.xml to remove the Xaxis value from displaying on the chart?
Nice site maybe we can do something!Free SMS and Free Fax
I notice there is a gas guage type chart, how could one take adantage of this in Coldfusion?
Amazing tip prayank ! Keep writing "Did you know?" once in a week ;)
- Arun
Can we use to display stocks technical charts like candle stick ?
In the documentation in the table with attributes, the description of the style-attribute is "XML file or string to use to specify the style of the chart."
I have tried hard to get it to work with a string. But with no luck at all.
Well done on a great blog prayank. I was searching for information on bar code scanners and came across your post Modifying look and feel of charts - Part I (very Basic) - not exactly what I was looking for related to bar code scanners but very interesting all the same!
I have a problem with my x axis scale. I created a styel.xml file and put the following xaxis tag:
xAxis type="Scale" scaleMin="0" scaleMax="10" labelCount="11" isBucketed="false"
I also set
isHideOverlapped="false"
What I needed was a scale at the bottom from 0 to 100 with intervals every 10 count (i.e. 0, 10, 20, 30,...100) - so I set the min=0 and the max=100 and the labelcount=11. For some reason it just doesn't work. I end up with the final number =98 instead of 100.??? any clues as to how to set this.
Does anyone know how to create a bubble chart using CFChart? I have been playing around w/the style attribute creating style.xml files using webcharts.bat. I seem to be close, but don't know how to set the 'size' parameter for the bubble radius? I'm trying to convert SVG graphs due to user restrictions here.
ALso, does anyone know how to make the background transparent or an image?
I was not able to download mystyle.xml. The link is no longer active. Help?
Save on discount prescription drugs. Is the leading pharmacy and drug store in the United States. Quick shipping, and free secure online medical consultations
4XcMQP Your blog is great. Articles is interesting!
r9n5YA Nice Article.
apIZdE Nice Article.
actually, that's brilliant. Thank you. I'm going to pass that on to a couple of people.
Nice Article.
Hello all!
Hello all!
Please write anything else!
Good job!
Good job!
Magnific!
g4p7r4 Wonderful blog.
Wonderful blog.
check out cf examples here...
http://www.cf-examples.net
welcome to the wow power leveling cheap Wow gold service site, buy cheap wow gold,wow gold,world of warcraft power leveling buy wow gold
Weaknesses of World Of Warcraft Gold the client-server model used by World of Warcraft have been wow power levelingexploited in order to crash the cluster of servers that aoc goldmake up a realm. Exploits also include characters being able to instantly Cheapest Wow Goldchange location or teleport. The situationbecame worse cheap wow goldwhen trying to coordinate activities across a number of playersor guilds on the same realm.World of Warcraft Lead Producer, stated that new realms would be introduced to warhammer goldrelieve the burden on existing ones. Existing realms would be upgraded.
Although the game wow gold follows a similar model to others in the genreand was noted for having wow gold cheapmany familiar concepts from roleplaying games, the new approaches gold4powerto reduce pauses between game encounters was well liked. At various times, World of Warcraft players have experienced problems with connecting to and logging in to wow gold for sale the game. Sudden server crashes that would force realms offline also occurred.
Viagra Online Pharmacy its a serious pharmacy to get any type of medicine !! trust me !!
This post is about charts, not about Health Care so watch out man.
cheap viagra walmart cheapest viagra in uk instructions for viagra use viagra uterine thickness viagra women viagra and cocaine 18 takes viagra buying viagra in uk buy sublingual viagra online can viagra be used by women viagra oral which is better cialis or viagra buy viagra australia where to buy viagra
[url=http://www.xbox360achievements.org/forum/member.php?u=259462]mexitil online pharmacy[/url]
[url=http://www.xbox360achievements.org/forum/member.php?u=259462]buy mexitil generic[/url]
Post a Comment