Cfchart challenge

How can we make cfchart generate meaning chart when data deviation is in four decimal points? here’s some sample data,

11/09/2019 --> 0.9063
11/10/2019 --> 0.9062
11/11/2019 --> 0.9063
11/13/2019 --> 0.9086
11/14/2019 --> 0.9093
11/15/2019 --> 0.9063
11/18/2019 --> 0.9041
11/20/2019 --> 0.9028
11/20/2019 --> 0.9042
11/21/2019 --> 0.9016
11/22/2019 --> 0.9043
11/25/2019 --> 0.9084

Use scaleFrom and scaleTo in cfchart to shrink the range.

1 Like

Awesome. It works. Thank you.


Is there a way to turn





numberformat() function should work. I think you have to use “0” mask.

1 Like

It makes sense. however, neither of the following tasks for numberformat works to append the two 00 s when needed.

What version of Lucee are you using. I just tested on and it worked just fine.

numberFormat(0.79, "__.0000")

It works.

#numberFormat(0.79, "__.0000")#

With the following context, it does not work.

<cfset myItem ="balbal">
<cfset myValue = ".79">
<cfchartdata item="#myItem#" value="#numberFormat(myValue,'__.0000')#">

lucee docker image: lucee4

I’m pretty sure cfchartdata converts to a Java number losing the formatting.
Can you make your chart x100 or something?
If not, there isn’t much you can do.

1 Like

Ok, it got me thinking, so, I tried the following:

<cfset myItem ="balbal">
<cfset myValue = "0.79">
<cfif len(myValue) eq 4>
	<cfset myValue = "#myValue#00">
	<cfset myValue = "(#myValue# * 100)">
<cfchartdata item="#myItem#" value="#myValue#">
<cfchartdata item="#myItem#" value="#decimalformat(myValue,'__.0000')#">

too bad, to no avail. Worth a try tho, much appreciated anyway.

A new question.
For a chart spanning across month boarder, that is, part of the data is from the previous month and part of it is from current month. For the Y legend, initially I was using dateformat(date, “mm/dd”), but now I think for more clarity, simply day(date) and adding a short form Month string for the current month for the very first data set for the current month would save real estate. Thus, the Y line may read below:
28 29 30 Dec 1 2 3 …
It’s doable. However, when a user uses cursor over to a specific data point, I’d prefer the date field to display “mm/dd” ( NOT just day value of the field ).
The cfchartdata tag does not seem to support it. Is there any undocumented feature that would support this?