8 Replies Latest reply on Oct 11, 2006 12:21 AM by MikerRoo

    Webcharts - various issues

    DBytes
      We are using Webcharts (7.0.2) in a large government website and there are a few issues with Webcharts we are having - management are talking about using another charting tool unless we can get these rectified. We are presenting scientific data in various formats, but mostly line and bar charts.

      The issues are:

      1. If you use a symbol on the chart for marking points (eg a star shape) the legend always uses a square, not the same shape. Is it possible for the legend to display the shape that’s on the chart? Eg http://www.drewbytes.com.au/images/chart3.gif should have circles in the legend not squares.

      2. Let’s say a data range is 0 -250. When drawing lines on the chart, if they go close to zero Webcharts extends the Y axis value to -50 (in this case) rather than leaving at zero. We have tried forcing Webcharts to use a minimum value of 0 on Y axis, but we can’t get it to work. See image here for an example: http://www.drewbytes.com.au/images/chart1.gif

      3. We want to colour a portion of the background of the chart in some situations to signify a certain period of data. The only way we can see to do this is set a column that’s drawn first with the range of values in the chart. But there in lies the problem – as Webcharts decides the min/max values dynamically, how do we know what the maximum value is to set our column with so that it covers the entire height of the chart? Again, we’ve tried telling Webcharts to use a max value for the Y axis but it doesn’t seem to work. Eg in http://www.drewbytes.com.au/images/chart2.gif we want the yellow bar to go right to the top of the chart.

      4. Is there a way to display financial years on a chart, eg “03/04” rather than just “2004” ? The chart has to be displayed in “DateTimePattern” format as not every year has a data entry and if it’s not in DateTimePattern format then the chart won’t draw the scale correctly when there are missing years.

      Does any one have any ideas on any of the above? Any help appreciated.

      We call Webcharts via Java, eg:

      oMyWebChart = createObject("Java","com.gp.api.jsp.MxServerComponent");
      oMyApp = getPageContext().getServletContext();
      oSvr = oMyWebChart.getDefaultInstance(oMyApp);
      oMyChart2 = oSvr.newImageSpec();
      oMyChart2.width = this.chartXSize;
      oMyChart2.height= this.chartYSize;
      oMyChart2.type = this.chartType;
      oMyChart2.style = this.chartStyle;
      oMyChart2.model = this.sChartModel;
        • 1. Re: Webcharts - various issues
          MikerRoo Level 1
          Webcharts, as shipped with CF, can meet all 4 issues you list -- but with many conditions and caveats.
          Webcharts and cfchart are marketing toys that work poorly in the real world. I recommend you using something decent instead.
          Also, as you find cfchart bugs, please inform Adobe loudly and often -- maybe they'll finally fix some of them.

          Anyway...
          1. Use marker shape in the legend: This is possible for line and curve charts (but not scatter!!! ).
            Add <legend useMarkers="true"/> to your xml style just after the axis sections.
          2. Y axis shows negative range for no good reason: This is a bug that was fixed in 7.01 and regressed in 7.02! Please let Adobe know how yo feel about it.
            Anyway, you can usually get your manual scale to stick if you add autoAdjust="false" to your frameChart tag (in the xml style file).
          3. Vertical grids are not supported: Again, switch to a decent chart engine. For your workaround, see item 2.
          4. Display years like "03/04": Use a label format like <labelFormat style="DateTimePattern" pattern="MM/yy"/>.
            Make sure your parseFormat matches your data exactly. Search this forum for parseFormat for more info.

          • 2. Re: Webcharts - various issues
            DBytes Level 1
            Thanks for your great response - no 1 and 2 were a great help. Much appreciated.

            Can you please advise other charting tools that you would recommend we take a look at?
            • 3. Re: Webcharts - various issues
              MikerRoo Level 1
              We use ChartDirector ( http://www.advsofteng.com/).

              It's very affordable, very powerful, and integrates easily with every language but CF (you need Java or C++ skilz to use it with CF).
              • 4. Re: Webcharts - various issues
                DBytes Level 1
                Thanks very much for the link to ChartDirector.

                Do you think you could possibly post a sample piece of code on how to call it just so I can get started?

                e.g. how do I "createObject" to get going and some code to draw a simple chart. I should be able to figure it out from there.

                Thanks very much. You have been a great help :)
                • 5. Re: Webcharts - various issues
                  MikerRoo Level 1
                  This should get you started:
                  http://www.advsofteng.com/cd_coldfusion.html

                  The forum on the site is pretty useful too.
                  • 6. Re: Webcharts - various issues
                    DBytes Level 1
                    Thank you - got the example chart working :)
                    • 7. Re: Webcharts - various issues
                      DBytes Level 1
                      Just one last question - I promise. Sorry to keep bugging you.

                      One initial problem I've encountered when I converted the simpleline.jsp file is that in this example all the labels are numbers (1-5). This generates the following error: "The selected method setLabels was not found".

                      However, if I change just one label value to have a character at the start it will now work.

                      Obviously it is something like the Java class is expecting a string - it doesn't appear to like all numbers.

                      I've tried using javacast to set to a string type when setting the array, but no matter whan I do when all lables are numbers it returns the above error.
                      • 8. Re: Webcharts - various issues
                        MikerRoo Level 1
                        This is why I said you needed java or C++ skills.

                        The function you are calling is overloaded and CF is extremely poor at interfacing to overloaded functions.

                        If you can resolve it by forcing string, that is great. Sometimes adding an empty html tag, like <> will work and will be ignored by ChartDirector.

                        We call ChartDirector from C++ CFX tags -- which we also use to do insanely involved math on the data, before it is plotted.

                        You can create Java CFX(s) if that is easier for you.

                        Or just create a Java "Wrapper" class for the functions you want. This allows you to specify un-overloaded names that CF can use.