OCA reporting engine fork for dev and update.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.2 KiB

  1. odoo.define('kpi_dashboard.AltairWidget', function (require) {
  2. "use strict";
  3. var AbstractWidget = require('kpi_dashboard.AbstractWidget');
  4. var registry = require('kpi_dashboard.widget_registry');
  5. var AltairWidget = AbstractWidget.extend({
  6. template: 'kpi_dashboard.altair',
  7. fillWidget: function (values) {
  8. var widget = this.$el.find('[data-bind="value"]');
  9. widget.css('width', this.widget_size_x-20);
  10. widget.css('height', this.widget_size_y-90);
  11. var data = $.extend({
  12. height: this.widget_size_y - 90,
  13. width: this.widget_size_x - 20,
  14. autosize: {
  15. type: "fit",
  16. contains: "padding"
  17. },
  18. }, values.value.altair);
  19. vegaEmbed(
  20. widget[0],
  21. data,
  22. this.altairOptions(values)
  23. );
  24. },
  25. altairOptions: function () {
  26. return {
  27. actions: false,
  28. height: this.widget_size_y - 90,
  29. width: this.widget_size_x - 40,
  30. };
  31. },
  32. });
  33. registry.add('altair', AltairWidget);
  34. return AltairWidget;
  35. });