100000){
- label.push(""+dimensionNames[j]+': '+value.toFixed(0)+"
");
- }else{
- label.push(""+dimensionNames[j]+': '+value.toFixed(2)+"
");
- }
- }else{
- label.push(""+dimensionNames[j]+': '+value+"
");
+ const label = [];
+ const dimensionNames = param["dimensionNames"];
+ if (typeof (param['value']) == 'object' && dimensionNames.length == param['data'].length) {
+ for (let j = 1; j < dimensionNames.length; j++) {
+ const value = param['data'][j];
+ if (typeof (value) == 'number') {
+ if (value % 1 == 0 || value > 100000) {
+ label.push("" + dimensionNames[j] + ': ' + (value / 10000).toFixed(0) + "万 ");
+ } else {
+ label.push("" + dimensionNames[j] + ': ' + (value / 10000).toFixed(2) + "万 ");
}
+ } else {
+ label.push("" + dimensionNames[j] + ': ' + value + "
");
+ }
}
- }else if(param['seriesType']=="candlestick"){
- label.push("
");
- label.push("open: "+param['value'][1].toFixed(2)+"
");
- label.push("close: "+param['value'][2].toFixed(2)+"
");
- label.push("high: "+param['value'][4].toFixed(2)+"
");
- label.push("low: "+param['value'][3].toFixed(2)+"
");
- label.push("change: "+((param['value'][2]/param['value'][1]-1)*100).toFixed(2)+"
");
- label.push("range: "+((param['value'][4]/param['value'][3]-1)*100).toFixed(2)+"
");
- }else if(typeof(param['value'])=='number'){
- if (param['value']%1==0){
- label.push(""+param['value'].toFixed(0)+"
");
- }else{
- label.push(""+param['value'].toFixed(2)+"
");
+ } else if (param['seriesType'] == "candlestick") {
+ label.push("开: " + param['value'][1].toFixed(2) + " ");
+ label.push("高: " + param['value'][4].toFixed(2) + " ");
+ label.push("低: " + param['value'][3].toFixed(2) + " ");
+ label.push("收: " + param['value'][2].toFixed(2) + " ");
+ const increase = (param['value'][5] * 100);
+ const colors=['#254000','#3f6600','#5b8c00','#7cb305','#a0d911','#f5222d','#cf1322','#a8071a','#820014',"#5c0011"];
+ var color_index = Math.round((Math.min(Math.max(-10,increase),10)+10)/2-1);
+ label.push("涨幅: " + increase.toFixed(2) + " ");
+ label.push("振幅: " + ((param['value'][4] / param['value'][3] - 1) * 100).toFixed(2) + " ");
+ } else if (typeof (param['value']) == 'number') {
+ if (param['value'] > 10000) {
+ if (param['value'] % 1 == 0) {
+ label.push("" + param["seriesName"] + ":" + (param['value'] / 10000).toFixed(0) + "万 ");
+ } else {
+ label.push("" + param["seriesName"] + ":" + (param['value'] / 10000).toFixed(2) + "万 ");
+ }
+ } else {
+ if (param['value'] % 1 == 0) {
+ label.push("" + param["seriesName"] + ":" + param['value'].toFixed(0) + " ");
+ } else {
+ label.push("" + param["seriesName"] + ":" + param['value'].toFixed(2) + " ");
+ }
}
- }else if(param['value']){
- label.push(""+value+"
");
- }else{
- label.push("
");
+ } else if (param['value']) {
+ label.push("" + param['value'] + "
");
+ } else {
+ label.push(" ");
}
- var cardStr= label.join('');
+ const cardStr = label.join('');
labels.push(cardStr);
}
return labels.join('');
@@ -695,26 +708,25 @@ def candlestick_echarts(data_frame: pd.DataFrame, time_field: str = 'time', open
'textStyle': {'color': '#000'},
'position': Js("""
function (pos, params, el, elRect, size){
- var obj = {top: 10};
- obj[['left', 'right'][+(pos[0] < size.viewSize[0] / 2)]] = 30;
- return obj;
+ return {top: 30, left: 0};
}
- """)
+ """),
+ 'extraCssText': 'box-shadow: 0 0 0 rgba(0, 0, 0, 0);'
},
'axisPointer': {
'link': {'xAxisIndex': 'all'},
'label': {'backgroundColor': '#777'}
},
'toolbox': {
- 'show': True,
+ 'show': False,
'feature': {
'restore': {},
'saveAsImage': {}
}
},
'grid': [
- {'left': left_padding, 'right': right_padding, 'height': '70%'},
- {'left': left_padding, 'right': right_padding, 'top': '71%', 'height': '18%'}
+ {'left': left_padding, 'right': right_padding, 'height': '75%'},
+ {'left': left_padding, 'right': right_padding, 'top': '76%', 'height': '13%'}
],
'xAxis': [
{
@@ -835,7 +847,7 @@ def candlestick_echarts(data_frame: pd.DataFrame, time_field: str = 'time', open
'type': 'line',
'data': df[name].tolist(),
'smooth': True,
- 'showSymbol': False,
+ 'symbol': 'none',
'lineStyle': {'opacity': 0.5}
}
options['series'].append(series_ma)
@@ -877,6 +889,7 @@ def heatmap_echarts(data_frame: pd.DataFrame, x_field: str = None, y_field: str
df[label_field + '_label'] = data_frame[label_field]
df[color_field + '_color'] = data_frame[color_field]
options = {
+ 'animation': False,
'title': {'text': title},
'tooltip': {
'position': 'top',
@@ -958,6 +971,7 @@ def radar_echarts(data_frame: pd.DataFrame, name_field: str = None, indicator_fi
:return:
"""
options = {
+ 'animation': False,
'title': {
'text': title
},
@@ -1034,6 +1048,7 @@ def calendar_heatmap_echarts(data_frame: pd.DataFrame, date_field: str = None, v
date_end = pd.to_datetime(df[date_field].max()).strftime("%Y-%m-%d")
df[date_field] = pd.to_datetime(df[date_field]).dt.strftime("%Y-%m-%d")
options = {
+ 'animation': False,
'title': {
'text': title
},