Skip to content

Commit

Permalink
refactor: update model import
Browse files Browse the repository at this point in the history
  • Loading branch information
AlasDiablo committed Sep 15, 2023
1 parent 05956a2 commit 718fc93
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
} from '../../../chartsUtils';
import BarChart from '../../models/BarChart';
import { CustomActionVegaLite } from '../vega-lite-component';
import deepClone from 'lodash.clonedeep';
import InvalidFormat from '../../../InvalidFormat';
import { VEGA_ACTIONS_WIDTH } from '../vega-lite-component/VegaLiteComponent';

Expand All @@ -33,7 +32,7 @@ class BarChartView extends Component {

// Create a new bar chart instance

const barChartSpec = deepClone(new BarChart());
const barChartSpec = new BarChart();

// Set all bar chart parameter the chosen by the administrator

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import compose from 'recompose/compose';
import { field as fieldPropTypes } from '../../../../propTypes';
import PropTypes from 'prop-types';
import ContainerDimensions from 'react-container-dimensions';
import deepClone from 'lodash.clonedeep';
import {
lodexOrderToIdOrder,
VEGA_LITE_DATA_INJECT_TYPE_A,
Expand All @@ -25,7 +24,7 @@ class BubblePlotView extends Component {

// Create a new bubble plot instance

const bubblePlot = deepClone(new BubblePlot());
const bubblePlot = new BubblePlot();

// Set all bubble plot parameter the chosen by the administrator

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { Component } from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import compose from 'recompose/compose';
import deepClone from 'lodash.clonedeep';
import ContainerDimensions from 'react-container-dimensions';
import { CustomActionVegaLite } from '../vega-lite-component';
import {
Expand All @@ -27,7 +26,7 @@ class CartographyView extends Component {

// Create a new cartography instance

const cartography = deepClone(new Cartography());
const cartography = new Cartography();

// Set all cartography parameter the chosen by the administrator

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import HeatMap from '../../models/HeatMap';
import { field as fieldPropTypes } from '../../../../propTypes';
import PropTypes from 'prop-types';
import ContainerDimensions from 'react-container-dimensions';
import deepClone from 'lodash.clonedeep';
import {
lodexOrderToIdOrder,
VEGA_LITE_DATA_INJECT_TYPE_A,
Expand All @@ -25,7 +24,7 @@ class HeatMapView extends Component {

// Create a new heat map instance

const heatMap = deepClone(new HeatMap());
const heatMap = new HeatMap();

// Set all heat map parameter the chosen by the administrator

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import ContainerDimensions from 'react-container-dimensions';
import PieChart from '../../models/PieChart';
import { CustomActionVegaLite } from '../vega-lite-component';
import { VEGA_LITE_DATA_INJECT_TYPE_A } from '../../../chartsUtils';
import deepClone from 'lodash.clonedeep';

const styles = {
container: {
Expand All @@ -22,7 +21,7 @@ class PieChartView extends Component {

// Create a new pie chart instance

const pieChart = deepClone(new PieChart());
const pieChart = new PieChart();

// enable the orderBy in vega-lite

Expand Down
9 changes: 6 additions & 3 deletions src/app/js/formats/vega-lite/models/BarChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ import {
} from '../../chartsUtils';
import { VEGA_ACTIONS_WIDTH } from '../component/vega-lite-component/VegaLiteComponent';
import BasicChart from './BasicChart';
import barChartVL from './json/bar_chart.vl.json';
import barChartLabelsVL from './json/bar_chart_labels.vl.json';
import deepClone from 'lodash.clonedeep';

/**
* Class use for create bar chart spec
* Class used to create bar chart spec
*/
class BarChart extends BasicChart {
/**
Expand All @@ -30,8 +33,8 @@ class BarChart extends BasicChart {
top: 10,
bottom: 0,
};
this.model = require('./json/bar_chart.vl.json');
this.labelsModel = require('./json/bar_chart_labels.vl.json');
this.model = deepClone(barChartVL);
this.labelsModel = deepClone(barChartLabelsVL);
this.scale = 'linear';
this.labelAngle = {
x: 0,
Expand Down
4 changes: 3 additions & 1 deletion src/app/js/formats/vega-lite/models/BubblePlot.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import HeatMap from './HeatMap';
import bubblePlotVL from './json/bubble_plot.vl.json';
import deepClone from 'lodash.clonedeep';

class BubblePlot extends HeatMap {
constructor() {
super();
this.model = require('./json/bubble_plot.vl.json');
this.model = deepClone(bubblePlotVL);
}

/**
Expand Down
6 changes: 4 additions & 2 deletions src/app/js/formats/vega-lite/models/Cartography.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import BasicChart from './BasicChart';
import { MAP_EUROPE, MAP_FRANCE, MAP_WORLD } from '../../chartsUtils';
import { VEGA_ACTIONS_WIDTH } from '../component/vega-lite-component/VegaLiteComponent';
import cartographyVL from './json/cartography.vl.json';
import deepClone from 'lodash.clonedeep';

/**
* Class use for create cartography spec
* Class used to create cartography spec
*/
class Cartography extends BasicChart {
/**
* Init all required parameters
*/
constructor() {
super();
this.model = require('./json/cartography.vl.json');
this.model = deepClone(cartographyVL);
this.tooltip.category.field = 'properties.name';
this.worldPosition = 'world';
this.autosize = {
Expand Down
6 changes: 4 additions & 2 deletions src/app/js/formats/vega-lite/models/HeatMap.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import BasicChart from './BasicChart';
import { LABEL_ASC, LABEL_DESC } from '../../chartsUtils';
import heatmapVL from './json/heatmap.vl.json';
import deepClone from 'lodash.clonedeep';

/**
* Class use for create heatmap spec
* Class used to create heatmap spec
*/
class HeatMap extends BasicChart {
/**
* Init all required parameters
*/
constructor() {
super();
this.model = require('./json/heatmap.vl.json');
this.model = deepClone(heatmapVL);
this.flip = false;
this.padding = {
left: 10,
Expand Down
9 changes: 6 additions & 3 deletions src/app/js/formats/vega-lite/models/PieChart.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import BasicChart from './BasicChart';
import pieChartVL from './json/pie_chart.vl.json';
import pieChartLabelsVL from './json/pie_chart_labels.vl.json';
import deepClone from 'lodash.clonedeep';

/**
* Class use for create pie chart spec
* Class used to create pie chart spec
*/
class PieChart extends BasicChart {
/**
* Init all required parameters
*/
constructor() {
super();
this.model = require('./json/pie_chart.vl.json');
this.modelLabels = require('./json/pie_chart_labels.vl.json');
this.model = deepClone(pieChartVL);
this.modelLabels = deepClone(pieChartLabelsVL);
this.labels = false;
}

Expand Down

0 comments on commit 718fc93

Please sign in to comment.