Jump to content
JChartFX Community
  • 0
Sandy

JChartFx Responsive is not working

Question

 Hi

I am trying to make JChartFx responsive as below in Window Resize event but it is not working(I am trying in Firefox browser). Could somebody help me on this.

 $(window).resize(function (e) {
        var viewportWidth = $(window).width();
        var viewportHeight = $(window).height();
        
        if (viewportWidth < 800) {            
            $('#divChartPeopleJoined').css("width", "200px");
            var c = $('.classcontainingChart').find('.jchartfx');
            $©.each(function (i, chart) {                
                chart._ud(true);
            });
        }
        else {
            $('#divChartPeopleJoined').css("width", "600px");
            var c = $('.classcontainingChart').find('.jchartfx');
            $©.each(function (i, chart) {                
                chart._ud(true);
            });
        }
    });

 Here is my div..

<div id="ChartPeopleJoined" style="width: 600px; height: 300px; display: inline-block"></div>

and here is my chart code..

var chart1;

            chart1 = new cfx.Chart();
            chart1.getAnimations().getLoad().setEnabled(true);

            chart1.setGallery(cfx.Gallery.Area);
            chart1.setBorder(null);
            chart1._ud(true);

            chart1.getAxisX().setVisible(false);
            chart1.getAxisY().setVisible(false);

            chart1.getDataGrid().setVisible(false);
            chart1.getLegendBox().setDock(cfx.DockArea.Top);
            chart1.getLegendBox().setVisible(false);

            var allSeries = chart1.getAllSeries();
            allSeries.setMarkerShape(cfx.MarkerShape.Rect);

            var ChartPeopleJoined = document.getElementById('ChartPeopleJoined');
            chart1.create(ChartPeopleJoined);

 

Thanks

Sandeep Kumar

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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...