Jump to content
JChartFX Community
  • 0

Resize the chart


Question

Hi,

I would like to adjust the charts height after it has been drawn.  For example, if I output a chart and the user decided that the x axis labels were making the chart unreadable.  Then I want to offer a text box that resizes the containing div and then gets the chart repainted into it.  However the best I can get is that the chart is created as I want it however an old chart pane is visible but empty.

This is the code I am currently using:

function setHeightOfChart() {
    document.getElementById("ChartDiv1").style.height = ($(window).innerHeight() * (document.getElementById("CHARTDEPTH").value / 100)) + "px";
    chart1.updateSizeNow();
    chart1.create(document.getElementById("ChartDiv1"));
}

 

 

  • Like 1
Link to post
Share on other sites

9 answers to this question

Recommended Posts

  • 0

I apologize, the version we are currently shipping has this function obfuscated. I will make sure our next build (probably available in a couple of days or so) has a public doUpdate method you can call.

If you want to try it now, the obfuscated method name is _ud so your code would be chart._ud(true)

JuanC 

Link to post
Share on other sites
  • 0

Hi, I'm trying to make my webapp responsive and resizing the charts is very important, this is my code:

$(function(){

            $(window).resize(function(){

            var graficos = new Array();

            graficos = document.getElementsByClassName('jchartfx');

            for (var i = 0; i < graficos.length; i++)

 {

     graficos.doUpdate(true);

 }

            });

        }); 

 

So everytime the user resizes the window, the chart should resize too, but i can't get it to work, and keep getting this error

Uncaught TypeError: Object #<HTMLDivElement> has no method 'doUpdate' 

i've tried using the div and the svg element with the same result, I hope you can help me.

 

Thank you. 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...