{% with chart_type=chart_type|default:"line" responsive=responsive|default:True legend=legend|default:True tooltip=tooltip|default:True animation=animation|default:True width=width|default:"100%" height=height|default:"400px" %} {% with unique_id=title|default:"chart"|slugify|default:"chart" %} {% with canvas_id=canvas_id|default:"chart-"|add:chart_type|add:"-"|add:unique_id|default:"chart-default" %}
{% if title or description %}
{% if title %}

{{ title }}

{% endif %} {% if description %}

{{ description }}

{% endif %}
{% endif %}
'); return; } this.applyColors(); const options = this.chartOptions || this.getDefaultOptions(); this.chart = new Chart(this.$el, { type: '{{ chart_type }}', data: this.chartData, options: options }); }, updateChart() { if (this.chart) { this.applyColors(); this.chart.data = this.chartData; this.chart.update(); } }, destroyChart() { if (this.chart) { this.chart.destroy(); this.chart = null; } } }" x-init="initChart()" x-effect="updateChart()" @destroy="destroyChart()" class="w-full h-full" >
Carregando gráfico...
{% endwith %} {% endwith %} {% endwith %}