diff --git a/public/ploty.html b/public/ploty.html
index fd452fa..e5f92ab 100644
--- a/public/ploty.html
+++ b/public/ploty.html
@@ -33,23 +33,27 @@
const Controls = {
accounts_list: {
- ui_id: "accounts",
- init: async () => {
+ init: async ( ui_id ) => {
let accounts = await API.accounts();
- let ui_accounts = document.querySelector(`#${Controls.accounts_list.ui_id}`);
- ui_accounts.innerHTML = '';
+ let ui_accounts = document.querySelector(`#${ui_id}`);
+ let content = "";
- ui_accounts.addEventListener( 'change', event => Controls.accounts_list.onchange( event.target ) );
- Controls.accounts_list.onchange( ui_accounts );
+ ui_accounts.innerHTML = content;
+
+ let ui_accounts_select = document.querySelector(`#${ui_id} select`);
+
+ ui_accounts_select.addEventListener( 'change', event => Controls.accounts_list.onchange( event.target ) );
+ Controls.accounts_list.onchange( ui_accounts_select );
},
onchange: element => {
selected_accounts = Array.from( element.options ).filter( o => o.selected ).map( o => o.value );
@@ -57,28 +61,79 @@
Controls.main_graph.set( selected_accounts );
}
},
- main_graph: {
- ui_id: 'mainGraph',
- init: () => Controls.main_graph.set( selected_accounts ),
- set: async accounts => {
- /* 1. get graph_values for accounts */
- let values = await API.graph_values( "", accounts.join(" "), "monthly" );
- Plotly.newPlot( Controls.main_graph.ui_id,
- Object.keys(values).map( act => {
- return {
- name: act,
- type: "bar",
- x: values[ act ].map( reg => Utils.readable_date( new Date( reg.date ) ) ),
- y: values[ act ].map( reg => reg.amount)
- };
- }),
- {
- xaxis: {title: 'Dates'},
- yaxis: {title: 'Montant'},
- barmode: 'relative',
- title: 'Relative Barmode'
+ accounts_sliders: {
+ init: async ( ui_id ) => {
+ let accounts = await API.accounts();
+ let ui_accounts = document.querySelector(`#${ui_id}`);
+ let content = "