@ -4,8 +4,9 @@ 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 { getSheetIndex , getRangetxt , getvisibledatacolumn , getvisibledatarow } from '../../methods/get'
import { rowLocation , colLocation , mouseposition } from '../../global/location'
import { setluckysheet_scroll_status } from '../../methods/set'
import {
luckysheetMoveHighlightCell ,
luckysheetMoveHighlightCell2 ,
@ -15,8 +16,6 @@ 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'
let _ rowLocation = rowLocation
let _ colLocation = colLocation
@ -37,7 +36,7 @@ const dependLinks = [
]
// Initialize the chart component
function chart ( data ) {
function chart ( data , isDemo ) {
loadLinks ( dependLinks ) ;
seriesLoadScripts ( dependScripts , null , function ( ) {
@ -69,19 +68,61 @@ function chart(data) {
chartInfo . chartparam . jfrefreshchartall = jfrefreshchartall
chartInfo . chartparam . changeChartCellData = chartmix . default . changeChartCellData
chartInfo . chartparam . renderChart = chartmix . default . renderChart
chartInfo . chartparam . getChartJson = chartmix . default . getChartJson
// 初始化渲染图表
for ( let i = 0 ; i < data . length ; i ++ ) {
if ( data [ i ] . status == '1' ) {
renderCharts ( data [ i ] . chart )
renderCharts ( data [ i ] . chart , isDemo )
}
}
} ) ;
}
// rendercharts
function renderCharts ( chartLists ) {
function renderCharts ( chartLists , isDemo ) {
for ( let i = 0 ; i < chartLists . length ; i ++ ) {
let chart = chartLists [ i ]
let chart_id_c = chart . chart_id + '_c'
let modelChartShowHTML =
'<div id="${id}"class="luckysheet-modal-dialog luckysheet-modal-dialog-chart ${addclass}"tabindex="0"role="dialog"aria-labelledby=":41e"dir="ltr"><div class="luckysheet-modal-dialog-resize"><div class="luckysheet-modal-dialog-resize-item luckysheet-modal-dialog-resize-item-lt"data-type="lt"></div><div class="luckysheet-modal-dialog-resize-item luckysheet-modal-dialog-resize-item-mt"data-type="mt"></div><div class="luckysheet-modal-dialog-resize-item luckysheet-modal-dialog-resize-item-lm"data-type="lm"></div><div class="luckysheet-modal-dialog-resize-item luckysheet-modal-dialog-resize-item-rm"data-type="rm"></div><div class="luckysheet-modal-dialog-resize-item luckysheet-modal-dialog-resize-item-rt"data-type="rt"></div><div class="luckysheet-modal-dialog-resize-item luckysheet-modal-dialog-resize-item-lb"data-type="lb"></div><div class="luckysheet-modal-dialog-resize-item luckysheet-modal-dialog-resize-item-mb"data-type="mb"></div><div class="luckysheet-modal-dialog-resize-item luckysheet-modal-dialog-resize-item-rb"data-type="rb"></div></div><div class="luckysheet-modal-dialog-controll"><span class="luckysheet-modal-controll-btn luckysheet-modal-controll-update"role="button"tabindex="0"aria-label="修改图表"title="修改图表"><i class="fa fa-pencil"aria-hidden="true"></i></span><span class="luckysheet-modal-controll-btn luckysheet-modal-controll-max"role="butluckysheet_chartIns_indexton"tabindex="0"aria-label="最大化"title="最大化"><i class="fa fa-window-maximize"aria-hidden="true"></i></span><span class="luckysheet-modal-controll-btn luckysheet-modal-controll-del"role="button"tabindex="0"aria-label="删除"title="删除"><i class="fa fa-trash"aria-hidden="true"></i></span></div><div class="luckysheet-modal-dialog-content">${content}</div></div>'
let $t = $ (
replaceHtml ( modelChartShowHTML , {
id : chart_id_c ,
addclass : 'luckysheet-data-visualization-chart' ,
title : '图表生成' ,
content : ''
} )
) . appendTo ( $ ( '.luckysheet-cell-main' ) )
$ ( ` # ${ chart_id_c } ` ) . children ( '.luckysheet-modal-dialog-content' ) [ 0 ] . id = chart . chart_id
let container = document . getElementById ( chart_id_c )
let chart_json
if ( isDemo ) {
chart_json = chart . chartOptions
} else {
chart_json = chartInfo . chartparam . getChartJson ( chart . chart_id )
}
chartInfo . chartparam . renderChart ( { chart_id : chart . chart_id , chartOptions : chart_json } )
let width = chart . width
let height = chart . height
let left = chart . left
let top = chart . top
container . style . width = width + 'px'
container . style . height = height + 'px'
container . style . position = 'absolute'
container . style . background = '#fff'
container . style . left = left + 'px'
container . style . top = top + 'px'
// render.style.width = '100%'
// render.style.height = '100%'
container . style . zIndex = chartInfo . zIndex ? chartInfo . zIndex : 15
chartInfo . zIndex ++
}
}
function jfrefreshchartall ( flowdata1 , r_st , r_ed , c_st , c_ed ) {
@ -846,6 +887,7 @@ function chart_selection() {
} ,
rangeResizeDragged : function ( ) {
chartInfo . chart_selection . rangeResize = null
var updateJson = chartInfo . currentChart
updateJson . rangeTxt = getRangetxt (
chartInfo . currentSheetIndex ,