area-chart.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import $ from '../../shared/dom7.js';
  2. import AreaChart from './area-chart-class.js';
  3. import ConstructorMethods from '../../shared/constructor-methods.js';
  4. export default {
  5. name: 'areaChart',
  6. params: {
  7. areaChart: {
  8. el: null,
  9. lineChart: false,
  10. datasets: [],
  11. axis: false,
  12. axisLabels: [],
  13. tooltip: false,
  14. legend: false,
  15. toggleDatasets: false,
  16. width: 640,
  17. height: 320,
  18. maxAxisLabels: 8,
  19. formatAxisLabel: null,
  20. formatLegendLabel: null,
  21. formatTooltip: null,
  22. formatTooltipAxisLabel: null,
  23. formatTooltipTotal: null,
  24. formatTooltipDataset: null
  25. }
  26. },
  27. create() {
  28. const app = this;
  29. app.areaChart = ConstructorMethods({
  30. defaultSelector: '.area-chart',
  31. constructor: AreaChart,
  32. app,
  33. domProp: 'f7AreaChart'
  34. });
  35. app.areaChart.update = function update(el, newParams) {
  36. const $el = $(el);
  37. if ($el.length === 0) return undefined;
  38. const areaChart = app.areaChart.get(el);
  39. if (!areaChart) return undefined;
  40. areaChart.update(newParams);
  41. return areaChart;
  42. };
  43. }
  44. };