0

I'm getting this error when I trying to use pie chart with tabs.How can I solve it ?

var arr = JSON.parse('{!! json_encode($array) !!}');



var pieChartData = [], pieChartSeries = arr;
    var pieChartColors = ['#E91E63', '#03A9F4', '#FFC107', '#009688'];

    $.plot('#pie_chart[0]', pieChartData, {
        series: {
            pie: {
                show: true,
                radius: 1,
                label: {
                    show: true,
                    radius: 3 / 4,
                    formatter: labelFormatter,
                    background: {
                        opacity: 0.5
                    }
                }
            }
        },
        legend: {
            show: false
        }
    });

I gave style to div but it didn't worked.Also It's working when I use pie chart without tabs.

Also I tried to run this code after page load and document ready but not worked either.

<div id="pie_chart[0]" class="flot-chart"></div>

Also I gave style to div element too. but it not working.

Murat Kaya
  • 1,281
  • 3
  • 28
  • 52
  • 1
    Possible duplicate of [Flot pie chart gives error in firebug: "uncaught exception: Invalid dimensions for plot, width = null, height = null"](http://stackoverflow.com/questions/12366549/flot-pie-chart-gives-error-in-firebug-uncaught-exception-invalid-dimensions-f) – Pat Mar 15 '17 at 16:26
  • No its not duplicate of that. As I told I'm trying to use it with tabs. So its giving me this error. – Murat Kaya Mar 15 '17 at 22:28
  • If you could provide a [minimal, complete, and verifiable example](http://stackoverflow.com/help/mcve) it would help troubleshoot the problem. All you have given is an error message and incomplete code -- so as it stands it is a duplicate. – Pat Mar 15 '17 at 23:17
  • Possible duplicate of [Uncaught Invalid dimensions for plot, width = null, height = null for flot charts api](http://stackoverflow.com/questions/21719522/uncaught-invalid-dimensions-for-plot-width-null-height-null-for-flot-chart) This question is also about tabs. – Raidri Mar 16 '17 at 10:08
  • @Pat I edited the question and added the div. Its working when I use it without tabs. – Murat Kaya Mar 16 '17 at 13:30
  • @Raidri I look the question but How will I render the plot graphs and then move the divs into the tabs. – Murat Kaya Mar 16 '17 at 13:37

1 Answers1

0

Okay I solved problem.

Problem is I was giving id's with [] I deleted [] and used id like = chart_12 and its solved.

Murat Kaya
  • 1,281
  • 3
  • 28
  • 52