Andre Steenveld

  • Content count

  • Joined

  • Last visited

About Andre Steenveld

  • Rank
    Forum Newbie
  1. Hello all, I have been working with FusionCharts for a while now and I noticed some rather strange behaviour when setting JSON data on a chart to be rendered. Take this code for example: var data = { /* ... snip ... */ chart: { /* ... snip ... */ showlegend: true } }; chart.setJSONData( data ); chart.render( domNode ); If chart is a pie chart I would expect it to have a legend but the chart renders and there is no legend. According to the documentation we will have to use 1 or 0 to indicate so I tried this: var data = { /* ... snip ... */ chart: { /* ... snip ... */ showlegend: new Number( true ) // new Number( true ) == 1 but new Number( true ) !== 1 } }; chart.setJSONData( data ); chart.render( domNode ); Even though we have a Number now rendering the chart will throw a TypeError saying "Cannot read property 'pieYScale' of undefined". The work around is pretty obvious though: var data = { /* ... snip ... */ chart: { /* ... snip ... */ showlegend: legend ? 1 : 0, /* or you could automagically cast it to a number, this could cause some unexpected results though, some examples */ showlegend: new Number( legend ) + 0, showlegend: ~~ new Number( legend ) } }; chart.setJSONData( data ); chart.render( domNode ); legend being something that is truthy or falsy and sticking it in with the ?:-operator will make sure a literal is placed when you actually just need a boolean there. My questions: If any other value then 1 is supplied the legend will not render, but as long as it is a number literal nothing happens. Why is this, why not just use a boolean or the javascript type unsafe compare operator (==)? Also adding the showlegend property to the configuration of anything else then a Pie or Pie3d will cause it to show the message "Invalid data", is there a reason why its not just silently ignored? Best regards, André
  2. Legend With A Single Serie

    Thanks for the fast reply. Is there anywhere I can file a ticket or feature request for this issue? - André
  3. Legend With A Single Serie

    Hello Bindhu, Thank you for the even quicker reply. I have been working on a work-around for this issue by splitting up my data into separate series for every bubble/column. Although I haven't tried it for the bubble charts but I presume this won't really be a problem the size of the bubbles etc. By splitting the data into so many series the columns become quite thin and so far I haven't found any styling property to correct this. (As seen in the last screenshot in my first post) Is there a way I can put the column width for the padded columns to "0" and multiply the width of the data column by the amount of series I have? - Best regards André
  4. Legend With A Single Serie

    Thank you for the quick reply. I just read the documentation about the grid and it seems it is not possible to export it to SVG. Although pie charts are also always single series it is possible to add a legend on those, isn't it possible to apply the same trick to bar and bubble charts? - Best regards André
  5. Legend With A Single Serie

    Good day all, I have been working with FusionCharts XT for a little while now and I am quite impressed and happy to use it. Although I am running into a few problems, I want to create a chart with a single series and a legend because the labels on the X-axis are just abbreviation. With bubble charts I have the same problem, the text is to large for the bubble so there is a number in it which maps to the legend. I started experimenting with splitting my series into several smaller ones and filling up the "empty" but this doesn't have the desired effect the columns are very thing and not centered neatly. I attached some screenshots showing what I want and what I got so far. - André Steenveld