0
votes

I'm using cfchart tag to draw my line chart in ColdFusion.

My x-axis range is from 1 to 24 and it is fix number of labels for all my charts.

But in my chart, I may have values for first 10 (or any fix number from 1 to 24) points. I mean, my query row count will be 10.

So query with 24 points will show full graph ad query with 10 points will show x-axis values from 0 to 10. But I want to scale the chart for 24 points regardless of query count.

cfchart has an option called scaleFrom and scaleTo to fix the y-axis series, Is there any option for x-axis series?

Following is a chart and it should scale it for 24 points on x-axis (lines from the 10th point will not be there).

<cfchart format="jpg" 
    xaxistitle=""
    yaxistitle="" chartwidth="600" chartheight="120">

    <cfchartseries type="line" paintstyle="shade"
        query="qChart1"  markerstyle="circle"
        itemcolumn="CHARTLABEL"
        valuecolumn="INTCHART1" /> 
</cfchart>

alt text

2

2 Answers

1
votes

I think you are looking for

xAxistype="Scale" scaleMin="1" scaleMax="24"

xaxistype normally defaults to "category" which I believe is simply the query in order, but by setting to "scale" (must be all numeric values) you can alter this.

If you are wanting more custom formatting for charts fire up webcharts.bat in the charting folder of CF and fill your boots.

0
votes

Saul's answer is more elegant than mine, but I'll still share.

I had the same problem with showing monthly activity for the last year. Sites that had only been active briefly, or who had no traffic/growth/whatever I was tracking didn't display correctly.

Instead of using a cfchartseries displaying a query, I looped over the time to be displayed, used a query of queries to extract the data for that month, and then added a data point for that month.

A bit brute force, but it worked.