format y-axis in cfchart

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default format y-axis in cfchart

    The values displayed on the y-axis are are mix of float and int. The chart
    displays int values on the y-axis if I use only one cfchartseries tag. The code
    below calculates the value for the gridlines and scaleto attributes.
    Code:
    <cfset
    scTo=evaluate(ArrayMax(ListToArray(valuelist(qJobsLogged.JOBSCOUNT)))+1)>
    When I output this variable, the value returned is 88 and when I
    execute the below code I get the following on the y-axis: 6 ,18, 30, 42, 54,
    66, 78
    Code:
       <cfchart show3d='yes' gridlines='#evaluate(scTo+1)#'
    yaxistype='scale'  labelformat='number' scalefrom='0' scaleto='#scTo#'
    format='jpg'  xAxisTitle='log date' yAxisTitle='jobs logged' chartheight='300'
    chartwidth='450' sortxaxis='no' showborder='yes'  showxgridlines='yes'
    showygridlines='yes' seriesplacement='stacked' font='Arial' fontsize='12'
    fontbold='yes'>   <cfchartseries type='bar' serieslabel='Critical'
    query='qJobsLogged' itemcolumn='DTLOGGED' valuecolumn='JOBSCOUNT'>    <cfif
    qJobsLogged.jobPriority eq 1>        <cfchartdata item='#qJobsLogged.DTLOGGED#'
    value='#qJobsLogged.JOBCOUNT#'>    </cfif>  </cfchartseries>   </cfchart>
    However, when I add 3 more chartseries tag to the above code, I get
    27.7, 83, 138.4, 193.8, 249.1, 304.5
    Code:
       <cfset
    scTo=evaluate(ArrayMax(ListToArray(valuelist(qJobsLogged.JOBCOUNT)))+1)>
    <cfchart show3d='yes' gridlines='#evaluate(scTo+1)#' yaxistype='scale'
    labelformat='number' scalefrom='0' scaleto='#scTo#' format='jpg'
    xAxisTitle='log date' yAxisTitle='jobs logged' chartheight='300'
    chartwidth='450' sortxaxis='no' showborder='yes'  showxgridlines='yes'
    showygridlines='yes' seriesplacement='stacked' font='Arial' fontsize='12'
    fontbold='yes'>   <cfchartseries type='bar' serieslabel='Critical'
    query='qJobsLogged' itemcolumn='DTLOGGED' valuecolumn='JOBSCOUNT'>    <cfif
    qJobsLogged.jobPriority eq 1>        <cfchartdata item='#qJobsLogged.DTLOGGED#'
    value='#qJobsLogged.JOBCOUNT#'>    </cfif>  </cfchartseries>   <cfchartseries
    type='bar' serieslabel='Urgent' query='qJobsLogged' itemcolumn='DTLOGGED'
    valuecolumn='JOBCOUNT'>    <cfif qJobsLogged.jobPriority eq 2>
    <cfchartdata item='#qJobsLogged.DTLOGGED#' value='#qJobsLogged.JOBCOUNT#'>
    </cfif>  </cfchartseries>   <cfchartseries type='bar' serieslabel='Normal'
    query='qJobsLogged' itemcolumn='DTLOGGED' valuecolumn='JOBCOUNT'>    <cfif
    qJobsLogged.jobPriority eq 3>        <cfchartdata item='#qJobsLogged.DTLOGGED#'
    value='#qJobsLogged.JOBCOUNT#'>    </cfif>  </cfchartseries>   <cfchartseries
    type='bar' serieslabel='Other' query='qJobsLogged' itemcolumn='DTLOGGED'
    valuecolumn='JOBCOUNT'>    <cfif qJobsLogged.jobPriority gt 3>
    <cfchartdata item='#qJobsLogged.DTLOGGED#' value='#qJobsLogged.JOBCOUNT#'>
    </cfif>  </cfchartseries>   </cfchart>
    Can any mathematician help
    please Regards cfcoder

    SpectraKing100 Guest

  2. Similar Questions and Discussions

    1. CFChart in Flash Format
      Can a CFChart with a Flash format have transparency? For instance, when you create a flash formatted cfform there is a wmode attribute that can be...
    2. cfchart rotate x axis labels
      This should be very easy to do. I want my x axis labels to be horizontial not vertical. How do I do this? Thanks trainmom
    3. cfchart and the x axis
      I'm working on a weight loss application and am trying out the CFCHART tag for the first time. I'm charting weight over time. In working with the...
    4. cfchart axis does not round
      I've noticed that when using CFCHART and when I'm showing a bar data that on the axis is always uses decimal points when showing the range of my...
    5. cfchart problem: i have too many entries in on axis
      You can use the Webcharts utility , which is located in the charting directory. You can define your own style and then refrence it using the format...
  3. #2

    Default Re: format y-axis in cfchart

    Hi again, I'm just so loosing my focus here. Not knowing how this things works
    is probably what's getting me all frustrated. Ok, here is what my query looks
    like <cfquery name='qBar' datasource='testDB'> SELECT CONVERT(varchar(15),
    dt.dtlogged, 106) AS dtlogged, dt.jobcount, j.jobPriority, j.jobNumber FROM (
    SELECT CAST(CONVERT(varchar(15), logdatetime, 106) AS datetime) AS dtlogged,
    COUNT(*) AS jobcount FROM job WHERE logdatetime >= '01/02/2005
    00:00:00' AND logdatetime <= '02/02/2005 23:59:59' GROUP BY
    CAST(CONVERT(varchar(15), logdatetime, 106) AS datetime) ) dt JOIN job j ON
    dt.dtlogged = CAST(CONVERT(varchar(15), j.logdatetime, 106) AS datetime)
    ORDER BY dtLogged </cfquery> And when I dump it, it looks something like this:
    query CALLCOUNT JOBNUMBER JOBPRIORITY DTLOGGED 1 2
    01BS093789 2 01 Feb 2005 2 2 01BS093795 3
    01 Feb 2005 3 3 01BS093872 6 02 Feb 2005 4 3
    01BS093883 6 02 Feb 2005 5 3 01BS093888 1
    02 Feb 2005 I hope it is making sense so far. I now what to build a
    chart with the date on the x-axis and the no of jobs logged in a day on the
    y-axis. In the example above, there are 2 jobs logged on the 1st of Feb each
    with a different jobPriority. I want the the user to be able to see this in the
    chart which is why I've added the <cfif> block inside the chartseries tag, but
    becuase the cfif is inside the chartseries tag and not outside, the chart
    representation of the data is not right. I don't know the right way to do this.
    Can you please help Regards cfcoder

    SpectraKing100 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139