Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

How to integrate D3 chart into Qweb report in Odoo 10?

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
qwebreportgraphodoo-10
5987 Vizualizări
Imagine profil
tahirhan


I am trying to embed a D3 chart in qweb report. I managed to get data into the script but i can not use d3 object inside script. d3.v3.min.js is imported in assets but d3 object doesn't work in script.

Asset part :


<template id="report_style_assets" inherit_id="report.internal_layout">
    <xpath expr="." position="inside">
        <script charset="utf-8" type="text/javascript" src="http://my_server_adress:8069/my_module/static/src/js/libs/d3.v3.min.js"/>
    </xpath>
</template>

inside report :


<template id="my_module.hotel_daily_report">
            <t t-call="report.html_container">
                <t t-call="report.internal_layout">
                    <div class="page">

                        <div id="chart_div"></div>

                        <script charset="utf-8" type="text/javascript" src="http://my_server_adress:8069/my_module/static/src/js/libs/d3.v3.min.js"/>

                        <script t-attf-data="{{hotelData['graph_data']}}" type="text/javascript">

                            var chartId = "chart_div";
                            var check = true;

                            var start_date = new Date();
                            var end_date = new Date();
                            var min_value = 5.0;
                            var max_value = 9.0;
                            var graph_score_type = 'overall_score';
                            var graph_line_color = 'indigo';
                            var data = [];
                            var counter = 0;

                            var hotelDataStr = document.getElementsByTagName('script')[0].getAttribute("data").replace(/'/g, '"');

                            var result = JSON.parse(hotelDataStr);
                            var keyCounter = 0;

                            for (var key in result) {
                                try {
                                    data.push({
                                        time: new Date(result[key]['review_date']),
                                        value: parseFloat(result[key][graph_score_type])
                                    });

                                    if (check) {
                                        check = false;
                                        start_date = new Date(result[key]['review_date']);
                                    }
                                } catch (err) { }
                            }
                            var graph_width = 650;
                            var graph_height = 160;
                            var graph_margin = {
                                top: 20,
                                right: 20,
                                bottom: 40,
                                left: 40
                            };

                            end_date = new Date(result[key]['review_date']);


                            var svg = d3.select("#chart_div").append("svg")
                                    .attr("width", graph_width + graph_margin.left + graph_margin.right)
                                    .attr("height", graph_height + graph_margin.top + graph_margin.bottom)
                                    .append("g")
                                    .attr("transform", "translate(" + graph_margin.left + "," + graph_margin.top + ")");


                            document.getElementById("chart_div").innerHTML = "test passed";
                </script>
            </div>
        </t>
    </t>
</template>

Everything works until d3 part in script. I saw that there is a paid module for graphs in odoo reports, so it is possible but how to use d3 in script?

1
Imagine profil
Abandonează
George Vincent

Hi, Did you get solution?

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
odoo 16 report target new page scss
qweb report
Imagine profil
Imagine profil
1
apr. 25
2422
Missing external identifier on new external layout template Rezolvat
qweb report
Imagine profil
Imagine profil
2
mar. 25
3191
Translate month name in t-esc Qweb report Rezolvat
qweb report
Imagine profil
Imagine profil
Imagine profil
Imagine profil
Imagine profil
4
nov. 24
8452
QWeb Report Shows Different When Edit And Print Review Rezolvat
qweb report
Imagine profil
Imagine profil
1
mar. 24
3213
How display the currency symbol before the subtotal value on Quotation report? Rezolvat
qweb report
Imagine profil
Imagine profil
Imagine profil
3
sept. 23
26381
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now