Browse Source

'chart'

master
liurunze 5 years ago
parent
commit
b8cbc773b7
  1. 5
      src/controllers/expendPlugins.js
  2. 2
      src/core.js
  3. 13
      src/demoData/sheetCell.js
  4. 7
      src/expendPlugins/chart/chartmix.common.js
  5. 2
      src/expendPlugins/chart/chartmix.common.js.map
  6. 7
      src/expendPlugins/chart/chartmix.umd.js
  7. 2
      src/expendPlugins/chart/chartmix.umd.js.map
  8. 2
      src/expendPlugins/chart/chartmix.umd.min.js
  9. 2
      src/expendPlugins/chart/chartmix.umd.min.js.map
  10. 76
      src/expendPlugins/chart/plugin.js
  11. 1
      src/global/refresh.js
  12. 6
      src/store/index.js

5
src/controllers/expendPlugins.js

@ -3,13 +3,14 @@ import { chart } from '../expendPlugins/chart/plugin'
const pluginsObj = {
'chart':chart
}
/**
* Register plugins
*/
function initPlugins(plugins){
function initPlugins(plugins , data){
if(plugins.length){
plugins.forEach(plugin => {
pluginsObj[plugin]();
pluginsObj[plugin](data)
});
}
}

2
src/core.js

@ -90,7 +90,7 @@ luckysheet.create = function (setting) {
luckysheetConfigsetting.plugins = extendsetting.plugins;
// Register plugins
initPlugins(extendsetting.plugins);
initPlugins(extendsetting.plugins , extendsetting.data);
// Store formula information, including internationalization
functionlist();

13
src/demoData/sheetCell.js

@ -1164,7 +1164,18 @@ const sheetCell = {
}
},
"index": "0",
"chart": [],
"chart": [{
"sheetIndex": "0",
"dataSheetIndex": "0",
"chartType": "column",
"row": "[1,3]",
"column": "[3,3]",
"chartStyle": "default",
"width": "480",
"height": "288",
"left": "67",
"top": "11"
}],
"status": "1",
"order": "0",
"column": 18,

7
src/expendPlugins/chart/chartmix.common.js

@ -39025,7 +39025,7 @@ function changeChartCellData(chart_id, chartData) {
chart_json.defaultOption = defaultOption;
src_store.dispatch('chartSetting/updateChartItemChartlist', chart_json);
chartUtil_renderChart({
chartOptions: updateJson,
chartOptions: chart_json,
chart_id: chart_id
});
}
@ -40580,9 +40580,8 @@ if (typeof window !== 'undefined' && window.Vue) {
deleteChart: deleteChart,
resizeChart: resizeChart,
changeChartRange: changeChartRange,
changeChartCellData: changeChartCellData // ChartSetting,
// ChartRender
changeChartCellData: changeChartCellData,
renderChart: /* Cannot get final name for export "renderChart" in "./src/utils/exportUtil.js" (known exports: initChart createChart highlightChart deleteChart resizeChart resizeChartAll, known reexports: changeChartRange changeChartCellData) */ undefined
}));
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js

2
src/expendPlugins/chart/chartmix.common.js.map

File diff suppressed because one or more lines are too long

7
src/expendPlugins/chart/chartmix.umd.js

@ -39034,7 +39034,7 @@ function changeChartCellData(chart_id, chartData) {
chart_json.defaultOption = defaultOption;
src_store.dispatch('chartSetting/updateChartItemChartlist', chart_json);
chartUtil_renderChart({
chartOptions: updateJson,
chartOptions: chart_json,
chart_id: chart_id
});
}
@ -40589,9 +40589,8 @@ if (typeof window !== 'undefined' && window.Vue) {
deleteChart: deleteChart,
resizeChart: resizeChart,
changeChartRange: changeChartRange,
changeChartCellData: changeChartCellData // ChartSetting,
// ChartRender
changeChartCellData: changeChartCellData,
renderChart: /* Cannot get final name for export "renderChart" in "./src/utils/exportUtil.js" (known exports: initChart createChart highlightChart deleteChart resizeChart resizeChartAll, known reexports: changeChartRange changeChartCellData) */ undefined
}));
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js

2
src/expendPlugins/chart/chartmix.umd.js.map

File diff suppressed because one or more lines are too long

2
src/expendPlugins/chart/chartmix.umd.min.js

File diff suppressed because one or more lines are too long

2
src/expendPlugins/chart/chartmix.umd.min.js.map

File diff suppressed because one or more lines are too long

76
src/expendPlugins/chart/plugin.js

@ -2,6 +2,8 @@ import { seriesLoadScripts, loadLinks, $$ } from '../../utils/util'
import { generateRandomKey, replaceHtml } from '../../utils/chartUtil'
import { getdatabyselection, getcellvalue } from '../../global/getdata';
import chartInfo from '../../store'
import formula from '../../global/formula';
import { luckysheet_getcelldata } from '../../function/func';
import { getSheetIndex, getRangetxt } from '../../methods/get'
import { rowLocation, colLocation, mouseposition } from '../../global/location'
import {
@ -13,8 +15,7 @@ import {
} from '../../controllers/sheetMove';
import { isEditMode } from '../../global/validate';
import luckysheetsizeauto from '../../controllers/resize';
import { getvisibledatarow, getvisibledatacolumn } from '../../methods/get'
import { setluckysheet_scroll_status } from '../../methods/set';
import { getvisibledatarow, getvisibledatacolumn, setluckysheet_scroll_status } from '../../methods/get'
let _rowLocation = rowLocation
let _colLocation = colLocation
@ -24,18 +25,18 @@ const dependScripts = [
'https://unpkg.com/vuex@3.4.0',
'https://cdn.bootcdn.net/ajax/libs/element-ui/2.13.2/index.js',
'https://cdn.bootcdn.net/ajax/libs/echarts/4.8.0/echarts.min.js',
// 'expendPlugins/chart/chartmix.umd.js'
'http://26.26.26.1:8000/chartmix.umd.js'
'expendPlugins/chart/chartmix.umd.js'
// 'http://192.168.10.246:8000/chartmix.umd.js'
]
const dependLinks = [
'https://cdn.bootcdn.net/ajax/libs/element-ui/2.13.2/theme-chalk/index.css',
// 'expendPlugins/chart/chartmix.css'
'http://26.26.26.1:8000/chartmix.css'
'expendPlugins/chart/chartmix.css'
// 'http://192.168.10.246:8000/chartmix.css'
]
// Initialize the chart component
function chart() {
function chart(data) {
loadLinks(dependLinks);
seriesLoadScripts(dependScripts, null, function () {
@ -64,10 +65,69 @@ function chart() {
chartInfo.changeChartCellData = chartmix.default.changeChartCellData
chartInfo.getChartJson = chartmix.default.getChartJson
chartInfo.chart_selection = chart_selection()
chartInfo.chartparam.jfrefreshchartall = jfrefreshchartall
chartInfo.chartparam.changeChartCellData = chartmix.default.changeChartCellData
chartInfo.chartparam.renderChart = chartmix.default.renderChart
// 初始化渲染图表
for(let i = 0; i < data.length; i++){
if(data[i].status == '1'){
renderCharts(data[i].chart)
}
}
});
}
// rendercharts
function renderCharts(chartLists){
}
function jfrefreshchartall(flowdata1, r_st, r_ed, c_st, c_ed) {
let chart = chartInfo.currentChart
if(!chart){
return
}
if (chart.rangeArray.length == 1) {
var row = chart.rangeArray[0].row;
var column = chart.rangeArray[0].column;
//不在范围内的不更新
if (
r_st > row[1] ||
r_ed < row[0] ||
c_st > column[1] ||
c_ed < column[0]
) {
return
}
//根据原有的范围取得数据
var luckysheetgetcellrange = formula.getcellrange(
chart.rangeTxt
);
var sheetIndex =
luckysheetgetcellrange.sheetIndex == -1
? 0
: luckysheetgetcellrange.sheetIndex; //sheetIndex为-1时,转化为0
var selection = {
row: luckysheetgetcellrange.row,
column: luckysheetgetcellrange.column,
dataSheetIndex: sheetIndex
}; //数组
var getcelldata = luckysheet_getcelldata(chart.rangeTxt);
if (
typeof getcelldata === "object" &&
getcelldata.length != 0 &&
getcelldata.data.length != null
) {
//getcelldata有值,且不为空数组 && getcelldata.data为二维数组
var chartData = getcelldata.data;
chartInfo.chartparam.changeChartCellData(chart.chart_id, chartData);
}
}
}
function chart_selection() {
return {
create: function () {

1
src/global/refresh.js

@ -115,6 +115,7 @@ function jfrefreshgrid(data, range, cfg, cdformat, RowlChange, isRunExecFunction
if(server.allowUpdate){ //共享编辑模式
server.historyParam(Store.flowdata, Store.currentSheetIndex, range[s]);
}
Store.chartparam.jfrefreshchartall(Store.flowdata,range[s].row[0],range[s].row[1],range[s].column[0],range[s].column[1])
}
//刷新表格

6
src/store/index.js

@ -103,12 +103,14 @@ const Store = {
luckysheetCurrentChartZIndexRank : 100,
luckysheet_chart_redo_click:false, //撤销重做时标识
luckysheetCurrentChartMaxState: false, //图表全屏状态
jfrefreshchartall: '',
changeChartCellData: '',
renderChart: ''
},
functionList:null, //function list explanation
luckysheet_function:null,
chart_selection: {},
currentChart: {}
currentChart: ''
}
export default Store;
Loading…
Cancel
Save