Ask a Question related to Coldfusion - Getting Started, Design and Development.

  1. #1

    Default chart decimals

    Hi all,
    I'm looking for an example or some help making a linear graph of decimal
    pairs. I've tried to simplify it but still can't quite get everything to work
    right in ColdFusion. Here is my sample data (X,Y):
    (2.0,5.5) (8.0,2.5) (4.0,3.0) (1.1,4.0).

    I'm getting "Error Occurred While Processing Request" For input string: "2.0".
    Stack Trace...
    java.lang.NumberFormatException: For input string: "2.0"

    Can ColdFusion be used to create a linear plot/chart/graph when X and Y are
    both decimal numbers? Any suggestions appreciated.



    <cfchart xAxisType="scale">
    <cfchartseries type="line">
    <cfchartdata item=2.0 value=5.5>
    <cfchartdata item=8.0 value=2.5>
    <cfchartdata item=4.0 value=3.0>
    <cfchartdata item=1.1 value=4.0>
    </cfchartseries>
    </cfchart>

    CFkubio Guest

  2. Similar Questions and Discussions

    1. stacked Bar chart/Line chart hybrid- Charting
      Hi all, I have a requirement to have a stacked bar graph, with a line graph on the same chart. Has anyone here done this before? Apparently there...
    2. Refreshing chart data doesnt update chart
      I must be missing something simple here. I have a column chart that is using an array for its dataprovider. However, when I update the underlying...
    3. 14 decimals after comma
      For the benefit of the regulars, here's my plan: Each time a newcomer posts this question, I'll find the most recent example and move that thread...
    4. Error in DBD::Chart (called from DBIx::Chart)
      I'm receiving this error message when I run a PERL script: Use of uninitialized value in string ne at C:/Perl/site/lib/DBD/Chart.pm line 2491. ...
    5. Decimals not Getting into ASP
      We have an ASP page that grabs data from an Oracle 9i table and then dumps it into another. It had been working great until we swapped out servers....
  3. #2

    Default Re: chart decimals

    >... "2.0"
    That's a clue. item="2.0"


    BKBK Guest

  4. #3

    Default Re: chart decimals

    Thanks for your reply, BKBK, sorry I don't follow, what am I missing?
    Is it the data type?
    I know the documentation says if xAxisType = "scale" then "all cfchartdata
    item attribute values must be numeric."
    Is cfchartdata reading item=2.0 as a string of text?
    Do I have to set the data type to numeric? If so, how?


    CFkubio Guest

  5. #4

    Default Re: chart decimals

    What happens when you do item="2.0" in place of item=2.0?
    I always thought item must be a string, but can't remember whether
    value may accept fractions. I'm going off to check. In any case, I would
    do what most people do, which is in fact the accepted good preactice.
    Scale the values by a factor, e.g. 10.

    BKBK Guest

  6. #5

    Default Re: chart decimals

    I get the same thing with or without quotes. thanks for the suggestion, I take it "Scale the values by a f actor of 10 that you mean multiply the items (or x) by 10, right?
    CFkubio Guest

  7. #6

    Default Re: chart decimals

    >... you mean multiply the items (or x) by 10, right?
    yes
    >... I get the same thing with or without quotes
    I've checked that the chart specification does indeed accept
    decimals. In MX7 anyway. But not with the attribute xAxisType="scale".
    This should do you.

    <cfchart>
    <cfchartseries type="line">
    <cfchartdata item="2.0" value=5.5>
    <cfchartdata item="8.0" value=2.5>
    <cfchartdata item="4.0" value=3.0>
    <cfchartdata item="1.1" value=4.0>
    </cfchartseries>
    </cfchart>

    BKBK Guest

  8. #7

    Default Re: chart decimals

    I got something working now, going back to your previous suggestion, I
    multiplied the data by a factor of 100, then CAST AS int to remove the decimal
    places from query data.
    xAxisType has to be scale, otherwise the data is just string, (it can be
    sorted alphabetically but the numbers won't appear in a linear scale).

    CFkubio 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