marketIcon method
dynamic
marketIcon(
- dynamic x,
- dynamic y,
- dynamic w,
- dynamic h,
Implementation
marketIcon(x, y, w, h) {
var pathData = {};
var iconPath = [];
marksDataPoint = [];
if (chartData.marksData.isNotEmpty) {
var list = [];
var i = 0,il = chartData.marksData.length;
for(i = 0;i<il;i++){
if(chartData.marksData[i]['codeId'] == klineState.widget.propertys['codeId']){
list = chartData.marksData[i]['list'];
break;
}
}
if(list.isNotEmpty){
il = list.length;
for (i = 0; i < il; i++) {
var markObj = list[i];
markObj['codeId'] = klineState.widget.propertys['codeId'];
}
marksDataPoint = pointKData(x, y, w, h, list);
for (int j = 0; j < marksDataPoint.length; j++) {
var v = marksDataPoint[j];
String icon = klineState.widget.propertys['themeType'] == ThemeType.dark?v['icondark']:v['iconlight'];
String id = '${v['codeId']}${v['time']}$icon';
dynamic iconSize = imageSize[id];
double imagew = 0;
if(v['width'] != null && v['width']>0){
imagew = v['width'];
}else if(iconSize != null){
imagew = iconSize['w'];
}
double imageh = 0;
if(v['height'] != null && v['height']>0){
imageh = v['height'];
}else if(iconSize != null){
imageh = iconSize['h'];
}
double xoffer = 0;
if(v['xlayout'] == 'center'){
xoffer = -imagew/2;
}else if(v['xlayout'] == 'right'){
xoffer = -imagew;
}
double yoffer = 0;
if(v['ylayout'] == 'center'){
yoffer = -imageh/2;
}else if(v['ylayout'] == 'bottom'){
yoffer = -imageh;
}
double imagex = v['px'];
if(v['offx'] != null && v['offx'] != 0){
imagex += v['offx'];
}else{
imagex += xoffer;
}
double imagey = v['py'];
if(v['offy'] != null && v['offy'] != 0 ){
imagey+=v['offy'];
}else{
imagey+=yoffer;
}
v['size'] = {
'x': imagex,
'y': imagey,
'w': imagew,
'h': imageh,
};
bool isCircle = v['isCircle']??false;
dynamic borderColor = v['borderColor'];
iconPath.add([
"drawIcon",
[
id,
icon,
imagex,
imagey,
imagew,
imageh,
isCircle,
borderColor,
]
]);
}
}
}
pathData = {'iconPath': iconPath,'imageSize':imageSize};
return pathData;
}