import svgObject from "./svgOjbect";
|
import ConstParas from "@/utils/constParas.js";
|
import UnitHelper from "@/utils/unit.js";
|
import PointToleranceConfig from "./PointToleranceConfig.js";
|
import languageHelper from "@/utils/languageHelper.js";
|
import coordinateHelper from "@/utils/coordinateHelper.js";
|
|
var ConnChartDiagram = function () {
|
var m_svg;
|
|
var m_unit = { Q: 1, H: 0, P: 1, NPSH: 0 }; //功率、流量、扬程单位集合
|
var m_divChartName; //容器DIV名称
|
var m_chartSize; //图表尺寸
|
var m_localizationType; //语言类型
|
|
|
var m_pumpInfo; //基本信息
|
var m_chartObject;
|
var m_coordinatePara; //坐标
|
var m_coordinateDict = {};
|
var m_connectType = 0;//0 并联 1串联
|
var m_connectNum = 1;
|
var m_originWorkCurve;
|
var m_connectCurveList;
|
|
|
var m_dispVerticalLine1 = false; //查询线是否显示
|
var onChangeQueryDataCb = null; //查询外部回调
|
|
var m_chartSetting; //设置
|
var m_displayStyle; //显示设置
|
|
var m_chartDiagramPanelStyle = ConstParas.ChartDiagramPanelStyle.Two;
|
|
var m_isDispCurveQE = false; //是否显示效率
|
var m_isDispCurveNPSH = false; //是否显示效率
|
var m_isHaveNpsh = false; //是否显示汽蚀
|
|
|
|
var m_designPointTolerance = [0.91, 1.09, 0.95, 1.05]; //设计点公差
|
|
//设置颜色
|
var setObjectColor = function (isMonorColor) {
|
m_displayStyle.IsMonoColor = isMonorColor;
|
if (m_displayStyle.IsMonoColor) {
|
m_displayStyle.ColorH = "#000000";
|
m_displayStyle.ColorE = "#000000";
|
m_displayStyle.ColorP = "#000000";
|
m_displayStyle.ColorNPSH = "#000000";
|
m_displayStyle.ColorEquipment = "#000000";
|
m_displayStyle.ColorEqualParaCurvesE = "#000000";
|
m_displayStyle.ColorGridLine = "#cccccc";
|
} else {
|
m_displayStyle.ColorH = "#000000";
|
m_displayStyle.ColorE = "#000000";
|
m_displayStyle.ColorP = "#000000";
|
m_displayStyle.ColorNPSH = "#000000";
|
m_displayStyle.ColorEquipment = "#013317";
|
m_displayStyle.ColorEqualParaCurvesE = "#402db7";
|
m_displayStyle.ColorGridLine = "#cccccc";
|
}
|
m_displayStyle.SpectrumColor = "LightSkyBlue";
|
};
|
|
//初始化显示设置
|
var initialDispStyle = function (displayStyle, chartSetting) {
|
if (displayStyle != null) {
|
m_displayStyle = displayStyle;
|
} else {
|
m_displayStyle = {};
|
m_displayStyle.IsMonoColor = false;
|
m_displayStyle.IsDispSpectrum = true; //默认显示型谱
|
m_displayStyle.DesignPointDispType = 0; //设计点显示方式(eDesignPointDispType) Cross 0 LeftDownTriangle 2
|
}
|
|
|
m_isHaveNpsh = true;
|
if (m_chartObject != null && m_chartObject.MaxWaterCurveNPSH == null)
|
m_isHaveNpsh = false;
|
|
m_displayStyle.FeatCurveSize = 10;
|
m_displayStyle.EqualCurveSize = 9;
|
if (m_displayStyle.IsDispCurveLabel == null)
|
m_displayStyle.IsDispCurveLabel = true;
|
|
m_displayStyle.isDrawWaterMark = true;
|
m_displayStyle.isDispEquipmentCurve = false;
|
//是否显示子刻度
|
m_displayStyle.isDispMiniTick = true;
|
m_displayStyle.isRotateLabelX = false;
|
m_displayStyle.isAxisIntervalX = false;
|
m_displayStyle.MiniTickNumber = 4;
|
|
setObjectColor(m_displayStyle.IsMonoColor);
|
};
|
//
|
var initialSvg = function () {
|
if (m_divChartName == null) {
|
return false;
|
}
|
//
|
var m_svgID = "ConnectCurveSvg"; //暂时不知道做啥用
|
m_svg = new svgObject().init(
|
m_divChartName,
|
m_chartSize.TotalWidth,
|
m_chartSize.TotalHeight,
|
svgClick,
|
svgMove,
|
m_svgID
|
);
|
|
return true;
|
};
|
//初始化面板尺寸
|
var initialPanelSize = function () {
|
if (!initialSvg()) return;
|
|
if (m_coordinatePara == null) return;
|
|
if (m_chartSize == null) {
|
m_chartSize = {};
|
m_chartSize.TotalWidth =
|
document.getElementById(m_divChartName).clientWidth;
|
m_chartSize.TotalHeight =
|
document.getElementById(m_divChartName).clientHeight;
|
}
|
|
if (m_chartSize.TotalHeight < 500) m_chartSize.TotalHeight = 500;
|
|
var space_left = 70;
|
var space_right = 60;
|
var space_top = 10;
|
var space_bottom = 60;
|
if (m_coordinatePara.SpaceP > 99) {
|
space_left = 80;
|
}
|
if (m_coordinatePara.SpaceP <= 0.1) {
|
space_left = 80;
|
}
|
if (m_localizationType >= 2) {
|
space_left = 75;
|
space_right = 75;
|
}
|
|
m_chartSize.SpaceTop = space_top;
|
m_chartSize.SpaceRight = space_right;
|
m_chartSize.SpaceBottom = space_bottom;
|
m_chartSize.SpaceLeft = space_left;
|
|
m_chartSize.DiagramTop = space_top;
|
m_chartSize.DiagramLeft = space_left;
|
m_chartSize.DiagramRight = m_chartSize.TotalWidth - space_right;
|
m_chartSize.DiagramBottom = m_chartSize.TotalHeight - space_bottom;
|
|
m_chartSize.DiagramWidth =
|
m_chartSize.TotalWidth - space_left - space_right;
|
m_chartSize.DiagramHeight =
|
m_chartSize.TotalHeight - space_top - space_bottom;
|
|
m_chartSize.SpaceGridX =
|
m_chartSize.DiagramWidth / m_coordinatePara.GridNumberX;
|
|
if (m_chartDiagramPanelStyle == ConstParas.ChartDiagramPanelStyle.Whole) {
|
m_chartSize.UpDiagram = {};
|
m_chartSize.UpDiagram.Up = space_top;
|
m_chartSize.UpDiagram.Bottom = m_chartSize.TotalHeight - space_bottom;
|
m_chartSize.UpDiagram.SpaceGridY =
|
m_chartSize.DiagramHeight / m_coordinatePara.GridNumberY;
|
m_chartSize.UpDiagram.GridNumberY = m_coordinatePara.GridNumberY;
|
|
m_chartSize.DownDiagram = {}; //一样
|
m_chartSize.DownDiagram.Up = space_top;
|
m_chartSize.DownDiagram.Bottom = m_chartSize.TotalHeight - space_bottom;
|
m_chartSize.DownDiagram.SpaceGridY =
|
m_chartSize.DiagramHeight / m_coordinatePara.GridNumberY;
|
m_chartSize.DownDiagram.GridNumberY = m_coordinatePara.GridNumberY;
|
|
m_chartSize.PanelH = {};
|
m_chartSize.PanelH.Bottom =
|
m_chartSize.UpDiagram.Bottom -
|
m_chartSize.UpDiagram.SpaceGridY * m_coordinatePara.StartLineNoH;
|
m_chartSize.PanelH.Up =
|
m_chartSize.UpDiagram.Bottom -
|
m_chartSize.UpDiagram.SpaceGridY * m_coordinatePara.EndLineNoH;
|
|
m_chartSize.PanelE = {};
|
m_chartSize.PanelE.Bottom =
|
m_chartSize.UpDiagram.Bottom -
|
m_chartSize.UpDiagram.SpaceGridY * m_coordinatePara.StartLineNoE;
|
m_chartSize.PanelE.Up =
|
m_chartSize.UpDiagram.Bottom -
|
m_chartSize.UpDiagram.SpaceGridY * m_coordinatePara.EndLineNoE;
|
|
m_chartSize.PanelP = {};
|
m_chartSize.PanelP.Bottom =
|
m_chartSize.UpDiagram.Bottom -
|
m_chartSize.UpDiagram.SpaceGridY * m_coordinatePara.StartLineNoP;
|
m_chartSize.PanelP.Up =
|
m_chartSize.UpDiagram.Bottom -
|
m_chartSize.UpDiagram.SpaceGridY * m_coordinatePara.EndLineNoP;
|
|
m_chartSize.PanelNPSH = {};
|
m_chartSize.PanelNPSH.Bottom =
|
m_chartSize.UpDiagram.Bottom -
|
m_chartSize.UpDiagram.SpaceGridY * m_coordinatePara.StartLineNoNPSH;
|
m_chartSize.PanelNPSH.Up =
|
m_chartSize.UpDiagram.Bottom -
|
m_chartSize.UpDiagram.SpaceGridY * m_coordinatePara.EndLineNoNPSH;
|
|
//把间隙弄小点
|
var areaAttr = {
|
x: space_left,
|
y: space_top,
|
width: m_chartSize.DiagramWidth,
|
height: m_chartSize.DiagramHeight,
|
};
|
|
var areaStyle = {
|
"stroke-width": "1px",
|
stroke: "#cccccc",
|
fill: "#ffffff",
|
"fill-opacity": "0.5",
|
"zIndex:": 5,
|
};
|
|
//
|
m_svg.createArea(areaAttr, areaStyle);
|
} else {
|
var panel_space = 35;
|
m_chartSize.PanelSpace = panel_space;
|
|
var grid_num_h =
|
m_coordinatePara.EndLineNoH - m_coordinatePara.StartLineNoH;
|
var grid_num_e =
|
m_coordinatePara.EndLineNoE - m_coordinatePara.StartLineNoE;
|
|
var grid_num_up = Math.max(grid_num_h, grid_num_e);
|
if (m_coordinatePara.DislocationNumUp > 0)
|
grid_num_up = grid_num_up + m_coordinatePara.DislocationNumUp;
|
else grid_num_up = grid_num_up + 2; //多两条
|
if (!m_isDispCurveQE) {
|
grid_num_up =
|
m_coordinatePara.EndLineNoH - m_coordinatePara.StartLineNoH;
|
}
|
|
var grid_num_NPSH =
|
m_coordinatePara.EndLineNoNPSH - m_coordinatePara.StartLineNoNPSH;
|
var grid_num_p =
|
m_coordinatePara.EndLineNoP - m_coordinatePara.StartLineNoP;
|
var grid_num_down = grid_num_p;
|
|
if (m_isDispCurveNPSH) {
|
grid_num_down =
|
Math.max(grid_num_NPSH, grid_num_p) +
|
m_coordinatePara.DislocationNumDown;
|
}
|
|
m_chartSize.UpDiagram = {};
|
m_chartSize.UpDiagram.Up = space_top;
|
m_chartSize.UpDiagram.SpaceGridY =
|
(m_chartSize.DiagramHeight - panel_space) /
|
(grid_num_up + grid_num_down);
|
m_chartSize.UpDiagram.Bottom =
|
space_top + grid_num_up * m_chartSize.UpDiagram.SpaceGridY;
|
m_chartSize.UpDiagram.GridNumberY = grid_num_up;
|
|
m_chartSize.DownDiagram = {};
|
m_chartSize.DownDiagram.Up = m_chartSize.UpDiagram.Bottom + panel_space;
|
m_chartSize.DownDiagram.SpaceGridY =
|
(m_chartSize.DiagramHeight - panel_space) /
|
(grid_num_up + grid_num_down);
|
m_chartSize.DownDiagram.Bottom = m_chartSize.TotalHeight - space_bottom;
|
m_chartSize.DownDiagram.GridNumberY = grid_num_down;
|
|
m_chartSize.PanelH = {};
|
m_chartSize.PanelH.Bottom =
|
m_chartSize.UpDiagram.Up +
|
m_chartSize.UpDiagram.SpaceGridY * grid_num_h;
|
m_chartSize.PanelH.Up = m_chartSize.UpDiagram.Up;
|
|
m_chartSize.PanelE = {};
|
m_chartSize.PanelE.Bottom = m_chartSize.UpDiagram.Bottom;
|
m_chartSize.PanelE.Up =
|
m_chartSize.UpDiagram.Bottom -
|
m_chartSize.UpDiagram.SpaceGridY * grid_num_e;
|
|
m_chartSize.PanelP = {};
|
m_chartSize.PanelP.Up = m_chartSize.DownDiagram.Up;
|
m_chartSize.PanelP.Bottom =
|
m_chartSize.DownDiagram.Up +
|
m_chartSize.DownDiagram.SpaceGridY * grid_num_p;
|
|
m_chartSize.PanelNPSH = {};
|
m_chartSize.PanelNPSH.Bottom = m_chartSize.DownDiagram.Bottom;
|
m_chartSize.PanelNPSH.Up =
|
m_chartSize.DownDiagram.Bottom -
|
m_chartSize.DownDiagram.SpaceGridY * grid_num_NPSH;
|
|
|
}
|
};
|
//
|
var getSvgObjByName = function (objName) {
|
return m_svg.getPathByName(objName);
|
};
|
var removeElementById = function (id) {
|
var obj = document.getElementById(id);
|
if (obj != null) {
|
obj.remove();
|
}
|
};
|
var hideElementById = function (id) {
|
var obj = document.getElementById(id);
|
if (obj != null) {
|
obj.style.display = "none";
|
}
|
};
|
var showElementById = function (id) {
|
var obj = document.getElementById(id);
|
if (obj != null) {
|
obj.style.display = "";
|
}
|
};
|
//
|
var svgClick = function (e) { };
|
//
|
var svgMove = function (e) {
|
//alert("svgMove");
|
};
|
|
//翻译
|
var getTranslateString = function (cn) {
|
if (m_localizationType == 0) return cn;
|
return languageHelper.translateString(m_localizationType, cn);
|
};
|
|
//绘制x坐标(含标题)
|
var createXAxis = function (bottom_posi, title_space) {
|
if (m_coordinatePara == null) {
|
return;
|
}
|
|
//刻度线
|
var attrAxisTickX = {
|
stroke: "black",
|
"stroke-width": "1",
|
fill: "none",
|
zIndex: 10,
|
};
|
|
//刻度长度
|
var minTickLength = 4;
|
var tickLength = 6;
|
|
//刻度文字
|
var styleAxisLabelX = "font-size:11px;fill-opacity:1;fill:black;"; //font-weight:bold
|
|
//标题文字
|
var styleAxisTitleX =
|
"font-size:14px;fill-opacity:1;fill:black;font-weight:bold;";
|
|
//
|
for (var i = 0; i <= m_coordinatePara.GridNumberX; i++) {
|
let q = m_coordinatePara.MinQ + i * m_coordinatePara.SpaceQ;
|
|
var content = UnitHelper.valueFormat(
|
UnitHelper.getDispValueQ(UnitHelper.ConvertQ_fromM3H(m_unit.Q, q))
|
);
|
var posiX_grid = m_chartSize.DiagramLeft + m_chartSize.SpaceGridX * i;
|
//刻度线
|
var valueMain = [];
|
valueMain.push(
|
"M ",
|
posiX_grid,
|
" ",
|
bottom_posi,
|
" L ",
|
posiX_grid,
|
" ",
|
bottom_posi + tickLength
|
);
|
m_svg.createPath(null, valueMain.join(""), attrAxisTickX, null); //"TickLineX" + i
|
|
//文字 m_displayStyle.isAxisIntervalX
|
var label_y = bottom_posi + tickLength + 15;
|
if (m_displayStyle.isRotateLabelX) label_y = label_y + 1;
|
var attrAxisLabelX = {
|
opacity: 1,
|
x: posiX_grid,
|
y: label_y,
|
"text-anchor": "middle",
|
};
|
var transform = null;
|
if (m_displayStyle.isRotateLabelX)
|
transform = "rotate(45 " + posiX_grid + "," + label_y + ")";
|
if (m_displayStyle.isAxisIntervalX) {
|
if (i % 2 == 0)
|
m_svg.createText(
|
attrAxisLabelX,
|
styleAxisLabelX,
|
content,
|
10,
|
null,
|
transform
|
);
|
} else {
|
m_svg.createText(
|
attrAxisLabelX,
|
styleAxisLabelX,
|
content,
|
10,
|
null,
|
transform
|
);
|
}
|
|
//子刻度线
|
if (m_displayStyle.isDispMiniTick && i != m_coordinatePara.GridNumberX) {
|
for (var j = 0; j <= m_displayStyle.MiniTickNumber; j++) {
|
var pois_minTick =
|
posiX_grid +
|
(m_chartSize.SpaceGridX * j) / (m_displayStyle.MiniTickNumber + 1);
|
var valueMini = [];
|
valueMini.push(
|
"M ",
|
pois_minTick,
|
" ",
|
bottom_posi,
|
" L ",
|
pois_minTick,
|
" ",
|
bottom_posi + minTickLength
|
);
|
m_svg.createPath(null, valueMini.join(""), attrAxisTickX, null);
|
}
|
}
|
}
|
|
if (title_space > 0) {
|
var attrAxisTitleX = {
|
opacity: 1,
|
x: (m_chartSize.DiagramLeft + m_chartSize.DiagramRight) / 2,
|
y: bottom_posi + title_space,
|
"text-anchor": "middle",
|
};
|
if (m_displayStyle.isRotateLabelX)
|
attrAxisTitleX.y = attrAxisTitleX.y + 12;
|
|
let unit_name = UnitHelper.GetUnitNameQ(m_unit.Q);
|
m_svg.createText(
|
attrAxisTitleX,
|
styleAxisTitleX,
|
getTranslateString("流量") + " (" + unit_name + ")"
|
);
|
}
|
};
|
//绘制Y坐标(含标题)
|
var createYAxis_Whole = function () {
|
if (m_coordinatePara == null) {
|
return;
|
}
|
|
//刻度长度
|
var minTickLength = 3;
|
var tickLength = 6;
|
|
//扬程
|
if (m_coordinatePara.EndLineNoH > m_coordinatePara.StartLineNoH) {
|
//刻度线
|
var attrAxisTickH = {
|
stroke: m_displayStyle.ColorH,
|
"stroke-width": "1",
|
fill: "none",
|
};
|
|
//刻度文字
|
var styleAxisLabelH =
|
"font-size:11px; fill-opacity:1; fill:" + m_displayStyle.ColorH + ";";
|
//标签
|
var styleAxisTitleH =
|
"font-size:14px; ;fill-opacity:1; font-weight:bold; fill:" +
|
m_displayStyle.ColorH +
|
";";
|
|
let unit_h_name = UnitHelper.GetUnitNameH(m_unit.H);
|
|
//标签
|
var attrAxisTitleH = {
|
opacity: 1,
|
x: m_chartSize.DiagramLeft - 52,
|
y:
|
m_chartSize.UpDiagram.Bottom -
|
m_chartSize.UpDiagram.SpaceGridY *
|
((m_coordinatePara.EndLineNoH - m_coordinatePara.StartLineNoH) / 2 +
|
m_coordinatePara.StartLineNoH) -
|
10,
|
"text-anchor": "middle",
|
};
|
if (m_localizationType == 0) {
|
//中文
|
if (m_unit.H == UnitHelper.H.MPa || m_unit.H == UnitHelper.H.KPa) {
|
attrAxisTitleH.y = attrAxisTitleH.y - 5;
|
m_svg.createText(attrAxisTitleH, styleAxisTitleH, "压");
|
attrAxisTitleH.y = attrAxisTitleH.y + 15;
|
m_svg.createText(attrAxisTitleH, styleAxisTitleH, "力");
|
|
attrAxisTitleH.x = attrAxisTitleH.x + 3;
|
attrAxisTitleH.y = attrAxisTitleH.y + 21;
|
var transform =
|
"rotate(-90 " + attrAxisTitleH.x + "," + attrAxisTitleH.y + ")";
|
if (m_unit.H == UnitHelper.H.MPa)
|
m_svg.createText(
|
attrAxisTitleH,
|
styleAxisTitleH,
|
"(MPa)",
|
10,
|
null,
|
transform
|
);
|
else if (m_unit.H == UnitHelper.H.MPa)
|
m_svg.createText(
|
attrAxisTitleH,
|
styleAxisTitleH,
|
"(kPa)",
|
10,
|
null,
|
transform
|
);
|
} else {
|
attrAxisTitleH.y = attrAxisTitleH.y - 5;
|
m_svg.createText(attrAxisTitleH, styleAxisTitleH, "扬");
|
attrAxisTitleH.y = attrAxisTitleH.y + 15;
|
m_svg.createText(attrAxisTitleH, styleAxisTitleH, "程");
|
|
if (m_unit.H == 0) {
|
attrAxisTitleH.x = attrAxisTitleH.x + 3;
|
attrAxisTitleH.y = attrAxisTitleH.y + 21;
|
var transform =
|
"rotate(-90 " + attrAxisTitleH.x + "," + attrAxisTitleH.y + ")"; //不用多出空格否则全屏会有问题expandChartFullScreen
|
m_svg.createText(
|
attrAxisTitleH,
|
styleAxisTitleH,
|
"(" + unit_h_name + ")",
|
10,
|
null,
|
transform
|
);
|
}
|
}
|
} else {
|
var content = "Head (" + unit_h_name + ")";
|
if (m_unit.H == UnitHelper.H.MPa) {
|
content = "Press (MPa)";
|
}
|
if (m_unit.H == UnitHelper.H.KPa) {
|
content = "Press (KPa)";
|
}
|
var transform =
|
"rotate(-90 " + attrAxisTitleH.x + "," + attrAxisTitleH.y + ")"; //不用多出空格否则全屏会有问题expandChartFullScreen
|
m_svg.createText(
|
attrAxisTitleH,
|
styleAxisTitleH,
|
content,
|
10,
|
null,
|
transform
|
);
|
}
|
|
//
|
for (
|
var i = m_coordinatePara.StartLineNoH;
|
i <= m_coordinatePara.EndLineNoH;
|
i++
|
) {
|
var posiY_grid =
|
m_chartSize.UpDiagram.Bottom - m_chartSize.UpDiagram.SpaceGridY * i;
|
|
//主刻度
|
var valueMain = [];
|
valueMain.push(
|
"M ",
|
m_chartSize.DiagramLeft,
|
" ",
|
posiY_grid,
|
" L ",
|
m_chartSize.DiagramLeft - tickLength,
|
" ",
|
posiY_grid
|
);
|
m_svg.createPath(null, valueMain.join(""), attrAxisTickH, null);
|
|
//文字
|
var attrAxisLabelH = {
|
opacity: 1,
|
x: m_chartSize.DiagramLeft - 10,
|
y: posiY_grid + 5,
|
"text-anchor": "end",
|
};
|
var content = UnitHelper.valueFormat(
|
m_coordinatePara.DispMinH +
|
(i - m_coordinatePara.StartLineNoH) * m_coordinatePara.SpaceH
|
);
|
m_svg.createText(attrAxisLabelH, styleAxisLabelH, content);
|
|
//子刻度线
|
if (m_displayStyle.isDispMiniTick && i != m_coordinatePara.EndLineNoH) {
|
for (var j = 1; j <= m_displayStyle.MiniTickNumber; j++) {
|
var pois_minTick =
|
posiY_grid -
|
(m_chartSize.UpDiagram.SpaceGridY * j) /
|
(m_displayStyle.MiniTickNumber + 1);
|
var valueMini = [];
|
valueMini.push(
|
"M ",
|
m_chartSize.DiagramLeft,
|
" ",
|
pois_minTick,
|
" L ",
|
m_chartSize.DiagramLeft - minTickLength,
|
" ",
|
pois_minTick
|
);
|
m_svg.createPath(null, valueMini.join(""), attrAxisTickH, null);
|
}
|
}
|
}
|
}
|
|
//效率
|
if (
|
m_coordinatePara.EndLineNoE > m_coordinatePara.StartLineNoE &&
|
m_isDispCurveQE
|
) {
|
//刻度线
|
var attrAxisTickE = {
|
stroke: m_displayStyle.ColorE,
|
"stroke-width": "1",
|
fill: "none",
|
};
|
|
//刻度文字
|
var styleAxisLabelE =
|
"font-size:10px; fill-opacity:1; fill:" + m_displayStyle.ColorE + ";";
|
//标签
|
var styleAxisTitleE =
|
"font-size:14px; ;fill-opacity:1; font-weight:bold; fill:" +
|
m_displayStyle.ColorE +
|
";";
|
//
|
var attrAxisTitleE = {
|
opacity: 1,
|
x: m_chartSize.DiagramRight + 44,
|
y:
|
m_chartSize.UpDiagram.Bottom -
|
m_chartSize.UpDiagram.SpaceGridY *
|
((m_coordinatePara.EndLineNoE - m_coordinatePara.StartLineNoE) / 2 +
|
m_coordinatePara.StartLineNoE) -
|
10,
|
"text-anchor": "middle",
|
};
|
|
//标签
|
if (m_localizationType == 0) {
|
//中文
|
attrAxisTitleE.y = attrAxisTitleE.y - 5;
|
m_svg.createText(attrAxisTitleE, styleAxisTitleE, "效");
|
attrAxisTitleE.y = attrAxisTitleE.y + 15;
|
m_svg.createText(attrAxisTitleE, styleAxisTitleE, "率");
|
|
attrAxisTitleE.x = attrAxisTitleE.x + 6;
|
attrAxisTitleE.y = attrAxisTitleE.y + 24;
|
var transform =
|
"rotate(-90 " + attrAxisTitleE.x + "," + attrAxisTitleE.y + ")";
|
m_svg.createText(
|
attrAxisTitleE,
|
styleAxisTitleE,
|
"(%)",
|
10,
|
null,
|
transform
|
);
|
} else {
|
attrAxisTitleE.x = attrAxisTitleE.x + 6;
|
attrAxisTitleE.y = attrAxisTitleE.y + 24;
|
var transform =
|
"rotate(-90 " + attrAxisTitleE.x + "," + attrAxisTitleE.y + ")";
|
m_svg.createText(
|
attrAxisTitleE,
|
styleAxisTitleE,
|
"Eta (%)",
|
10,
|
null,
|
transform
|
);
|
}
|
|
//
|
for (
|
var i = m_coordinatePara.StartLineNoE;
|
i <= m_coordinatePara.EndLineNoE;
|
i++
|
) {
|
var content = m_coordinatePara.MinE + i * m_coordinatePara.SpaceE;
|
var posiY_grid =
|
m_chartSize.UpDiagram.Bottom - m_chartSize.UpDiagram.SpaceGridY * i;
|
//主刻度
|
var valueMain = [];
|
valueMain.push(
|
"M ",
|
m_chartSize.DiagramRight,
|
" ",
|
posiY_grid,
|
" L ",
|
m_chartSize.DiagramRight + tickLength,
|
" ",
|
posiY_grid
|
);
|
m_svg.createPath(null, valueMain.join(""), attrAxisTickE, null);
|
|
//文字
|
var attrAxisLabelE = {
|
opacity: 1,
|
x: m_chartSize.DiagramRight + 10,
|
y: posiY_grid + 5,
|
};
|
m_svg.createText(attrAxisLabelE, styleAxisLabelE, content);
|
|
//子刻度线
|
if (m_displayStyle.isDispMiniTick && i != m_coordinatePara.EndLineNoE) {
|
for (var j = 0; j < m_displayStyle.MiniTickNumber; j++) {
|
var pois_minTick =
|
posiY_grid -
|
(m_chartSize.UpDiagram.SpaceGridY * j) /
|
m_displayStyle.MiniTickNumber;
|
var valueMini = [];
|
valueMini.push(
|
"M ",
|
m_chartSize.DiagramRight,
|
" ",
|
pois_minTick,
|
" L ",
|
m_chartSize.DiagramRight + minTickLength,
|
" ",
|
pois_minTick
|
);
|
m_svg.createPath(null, valueMini.join(""), attrAxisTickE, null);
|
}
|
}
|
}
|
}
|
|
//功率
|
if (m_coordinatePara.EndLineNoP > m_coordinatePara.StartLineNoP) {
|
//刻度线
|
var attrAxisTickP = {
|
stroke: m_displayStyle.ColorP,
|
"stroke-width": "1",
|
fill: "none",
|
};
|
|
let unit_p_name = UnitHelper.GetUnitNameP(m_unit.P);
|
|
//刻度文字
|
var styleAxisLabelP =
|
"font-size:10px; fill-opacity:1; fill:" + m_displayStyle.ColorP + ";";
|
//标签
|
var styleAxisTitleP =
|
"font-size:14px; ;fill-opacity:1; font-weight:bold; fill:" +
|
m_displayStyle.ColorP +
|
";";
|
|
//标签
|
if (m_localizationType == 0) {
|
//中文
|
var attrAxisTitleP = {
|
opacity: 1,
|
x: m_chartSize.DiagramLeft - 52,
|
y:
|
m_chartSize.DownDiagram.Bottom -
|
m_chartSize.DownDiagram.SpaceGridY *
|
((m_coordinatePara.EndLineNoP - m_coordinatePara.StartLineNoP) /
|
2 +
|
m_coordinatePara.StartLineNoP),
|
"text-anchor": "middle",
|
};
|
if (m_coordinatePara.SpaceP <= 0.1) {
|
attrAxisTitleP.x = attrAxisTitleP.x - 5;
|
}
|
attrAxisTitleP.y = attrAxisTitleP.y - 5;
|
m_svg.createText(attrAxisTitleP, styleAxisTitleP, "功");
|
attrAxisTitleP.y = attrAxisTitleP.y + 15;
|
m_svg.createText(attrAxisTitleP, styleAxisTitleP, "率");
|
|
attrAxisTitleP.x = attrAxisTitleP.x + 2;
|
attrAxisTitleP.y = attrAxisTitleP.y + 25;
|
var transform =
|
"rotate(-90 " + attrAxisTitleP.x + "," + attrAxisTitleP.y + ")";
|
m_svg.createText(
|
attrAxisTitleP,
|
styleAxisTitleP,
|
"(" + unit_p_name + ")",
|
10,
|
null,
|
transform
|
);
|
} else {
|
var attrAxisTitleP = {
|
opacity: 1,
|
x: m_chartSize.DiagramLeft - 60,
|
y:
|
m_chartSize.DownDiagram.Bottom -
|
m_chartSize.DownDiagram.SpaceGridY *
|
((m_coordinatePara.EndLineNoP - m_coordinatePara.StartLineNoP) /
|
2 +
|
m_coordinatePara.StartLineNoP) -
|
10,
|
"text-anchor": "middle",
|
};
|
if (m_coordinatePara.SpaceP <= 0.1) {
|
attrAxisTitleP.x = attrAxisTitleP.x - 5;
|
}
|
attrAxisTitleP.x = attrAxisTitleP.x + 13;
|
attrAxisTitleP.y = attrAxisTitleP.y + 25;
|
var transform =
|
"rotate(-90 " + attrAxisTitleP.x + "," + attrAxisTitleP.y + ")";
|
m_svg.createText(
|
attrAxisTitleP,
|
styleAxisTitleP,
|
"Power (" + unit_p_name + ")",
|
10,
|
null,
|
transform
|
);
|
}
|
|
//
|
for (
|
var i = m_coordinatePara.StartLineNoP;
|
i <= m_coordinatePara.EndLineNoP;
|
i++
|
) {
|
var content = UnitHelper.valueFormat(
|
m_coordinatePara.MinP + i * m_coordinatePara.SpaceP
|
);
|
|
content = UnitHelper.formatToFixed(
|
parseFloat(UnitHelper.ConvertP(UnitHelper.P.KW, m_unit.P, content)),
|
1
|
);
|
|
var posiY_grid =
|
m_chartSize.DownDiagram.Bottom -
|
m_chartSize.DownDiagram.SpaceGridY * i;
|
//主刻度
|
var valueMain = [];
|
valueMain.push(
|
"M ",
|
m_chartSize.DiagramLeft,
|
" ",
|
posiY_grid,
|
" L ",
|
m_chartSize.DiagramLeft - tickLength,
|
" ",
|
posiY_grid
|
);
|
m_svg.createPath(null, valueMain.join(""), attrAxisTickP, null);
|
|
//文字
|
var attrAxisLabelP = {
|
opacity: 1,
|
x: m_chartSize.DiagramLeft - 10,
|
y: posiY_grid + 5,
|
"text-anchor": "end",
|
};
|
|
m_svg.createText(attrAxisLabelP, styleAxisLabelP, content);
|
|
//子刻度线
|
if (
|
m_displayStyle.isDispMiniTick &&
|
i != m_coordinatePara.EndLineNoP &&
|
i != m_coordinatePara.EndLineNoE
|
) {
|
for (var j = 1; j < m_displayStyle.MiniTickNumber; j++) {
|
var pois_minTick =
|
posiY_grid -
|
(m_chartSize.DownDiagram.SpaceGridY * j) /
|
m_displayStyle.MiniTickNumber;
|
var valueMini = [];
|
valueMini.push(
|
"M ",
|
m_chartSize.DiagramLeft,
|
" ",
|
pois_minTick,
|
" L ",
|
m_chartSize.DiagramLeft - minTickLength,
|
" ",
|
pois_minTick
|
);
|
m_svg.createPath(null, valueMini.join(""), attrAxisTickP, null);
|
}
|
}
|
}
|
}
|
|
//汽蚀
|
if (
|
m_isHaveNpsh &&
|
m_coordinatePara.EndLineNoNPSH > m_coordinatePara.StartLineNoNPSH
|
) {
|
//刻度线
|
var attrAxisTickNPSH = {
|
stroke: m_displayStyle.ColorNPSH,
|
"stroke-width": "1",
|
fill: "none",
|
};
|
|
//刻度文字
|
var styleAxisLabelNPSH =
|
"font-size:10px; fill-opacity:1; fill:" +
|
m_displayStyle.ColorNPSH +
|
";";
|
//标签
|
var styleAxisTitleNPSH =
|
"font-size:14px; ;fill-opacity:1; font-weight:bold; fill:" +
|
m_displayStyle.ColorNPSH +
|
";";
|
|
//标签
|
var attrAxisTitleNPSH = {
|
opacity: 1,
|
x: m_chartSize.DiagramRight + 44,
|
y:
|
m_chartSize.DownDiagram.Bottom -
|
m_chartSize.DownDiagram.SpaceGridY *
|
((m_coordinatePara.EndLineNoNPSH -
|
m_coordinatePara.StartLineNoNPSH) /
|
2 +
|
m_coordinatePara.StartLineNoNPSH) -
|
10,
|
"text-anchor": "middle",
|
};
|
if (m_localizationType == 0) {
|
//中文
|
attrAxisTitleNPSH.y = attrAxisTitleNPSH.y - 5;
|
m_svg.createText(attrAxisTitleNPSH, styleAxisTitleNPSH, "汽");
|
attrAxisTitleNPSH.y = attrAxisTitleNPSH.y + 15;
|
m_svg.createText(attrAxisTitleNPSH, styleAxisTitleNPSH, "蚀");
|
attrAxisTitleNPSH.x = attrAxisTitleNPSH.x + 6;
|
attrAxisTitleNPSH.y = attrAxisTitleNPSH.y + 24;
|
var transform =
|
"rotate(-90 " + attrAxisTitleNPSH.x + "," + attrAxisTitleNPSH.y + ")";
|
m_svg.createText(
|
attrAxisTitleNPSH,
|
styleAxisTitleNPSH,
|
"(m)",
|
10,
|
null,
|
transform
|
);
|
} else {
|
attrAxisTitleNPSH.x = attrAxisTitleNPSH.x + 6;
|
attrAxisTitleNPSH.y = attrAxisTitleNPSH.y + 24;
|
var transform =
|
"rotate(-90 " + attrAxisTitleNPSH.x + "," + attrAxisTitleNPSH.y + ")";
|
m_svg.createText(
|
attrAxisTitleNPSH,
|
styleAxisTitleNPSH,
|
"NPSHr (m)",
|
10,
|
null,
|
transform
|
);
|
}
|
|
//
|
for (
|
var i = m_coordinatePara.StartLineNoNPSH;
|
i <= m_coordinatePara.EndLineNoNPSH;
|
i++
|
) {
|
var content = UnitHelper.valueFormat(
|
m_coordinatePara.MinNPSH + i * m_coordinatePara.SpaceNPSH
|
);
|
var posiY_grid =
|
m_chartSize.DownDiagram.Bottom -
|
m_chartSize.DownDiagram.SpaceGridY * i;
|
//主刻度
|
var valueMain = [];
|
valueMain.push(
|
"M ",
|
m_chartSize.DiagramRight,
|
" ",
|
posiY_grid,
|
" L ",
|
m_chartSize.DiagramRight + tickLength,
|
" ",
|
posiY_grid
|
);
|
m_svg.createPath(null, valueMain.join(""), attrAxisTickNPSH, null);
|
|
//文字
|
var attrAxisLabelNPSH = {
|
opacity: 1,
|
x: m_chartSize.DiagramRight + 10,
|
y: posiY_grid + 5,
|
};
|
m_svg.createText(attrAxisLabelNPSH, styleAxisLabelNPSH, content);
|
|
//子刻度线
|
if (
|
m_displayStyle.isDispMiniTick &&
|
i != m_coordinatePara.EndLineNoNPSH
|
) {
|
for (var j = 0; j < m_displayStyle.MiniTickNumber; j++) {
|
var pois_minTick =
|
posiY_grid -
|
(m_chartSize.DownDiagram.SpaceGridY * j) /
|
m_displayStyle.MiniTickNumber;
|
var valueMini = [];
|
valueMini.push(
|
"M ",
|
m_chartSize.DiagramRight,
|
" ",
|
pois_minTick,
|
" L ",
|
m_chartSize.DiagramRight + minTickLength,
|
" ",
|
pois_minTick
|
);
|
m_svg.createPath(null, valueMini.join(""), attrAxisTickNPSH, null);
|
}
|
}
|
}
|
}
|
};
|
//绘制Y坐标(含标题)
|
var createYAxis_TwoPanel = function () {
|
if (m_coordinatePara == null) {
|
return;
|
}
|
|
//刻度长度
|
var minTickLength = 3;
|
var tickLength = 6;
|
|
//扬程
|
if (m_coordinatePara.EndLineNoH > m_coordinatePara.StartLineNoH) {
|
//刻度线
|
var attrAxisTickH = {
|
stroke: m_displayStyle.ColorH,
|
"stroke-width": "1",
|
fill: "none",
|
};
|
|
//刻度文字
|
var styleAxisLabelH =
|
"font-size:11px; fill-opacity:1; fill:" + m_displayStyle.ColorH + ";";
|
//标签
|
var styleAxisTitleH =
|
"font-size:14px; ;fill-opacity:1; font-weight:bold; fill:" +
|
m_displayStyle.ColorH +
|
";";
|
|
let unit_h_name = UnitHelper.GetUnitNameH(m_unit.H);
|
|
//标签
|
var attrAxisTitleH = {
|
opacity: 1,
|
x: m_chartSize.DiagramLeft - 52,
|
y: (m_chartSize.PanelH.Bottom + m_chartSize.PanelH.Up) / 2 - 10,
|
"text-anchor": "middle",
|
};
|
if (m_localizationType == 0) {
|
//中文
|
if (m_unit.H == UnitHelper.H.MPa || m_unit.H == UnitHelper.H.KPa) {
|
attrAxisTitleH.y = attrAxisTitleH.y - 5;
|
m_svg.createText(attrAxisTitleH, styleAxisTitleH, "压");
|
attrAxisTitleH.y = attrAxisTitleH.y + 15;
|
m_svg.createText(attrAxisTitleH, styleAxisTitleH, "力");
|
|
attrAxisTitleH.x = attrAxisTitleH.x + 3;
|
attrAxisTitleH.y = attrAxisTitleH.y + 21;
|
var transform =
|
"rotate(-90 " + attrAxisTitleH.x + "," + attrAxisTitleH.y + ")";
|
m_svg.createText(
|
attrAxisTitleH,
|
styleAxisTitleH,
|
"(MPa)",
|
10,
|
null,
|
transform
|
);
|
} else {
|
attrAxisTitleH.y = attrAxisTitleH.y - 5;
|
m_svg.createText(attrAxisTitleH, styleAxisTitleH, "扬");
|
attrAxisTitleH.y = attrAxisTitleH.y + 15;
|
m_svg.createText(attrAxisTitleH, styleAxisTitleH, "程");
|
|
if (m_unit.H == 0) {
|
attrAxisTitleH.x = attrAxisTitleH.x + 3;
|
attrAxisTitleH.y = attrAxisTitleH.y + 21;
|
var transform =
|
"rotate(-90 " + attrAxisTitleH.x + "," + attrAxisTitleH.y + ")"; //不用多出空格否则全屏会有问题expandChartFullScreen
|
m_svg.createText(
|
attrAxisTitleH,
|
styleAxisTitleH,
|
"(" + unit_h_name + ")",
|
10,
|
null,
|
transform
|
);
|
}
|
}
|
} else {
|
var content = "Head (" + unit_h_name + ")";
|
if (m_unit.H == UnitHelper.H.MPa) {
|
content = "Press (MPa)";
|
}
|
if (m_unit.H == UnitHelper.H.KPa) {
|
content = "Press (MPa)";
|
}
|
var transform =
|
"rotate(-90 " + attrAxisTitleH.x + "," + attrAxisTitleH.y + ")"; //不用多出空格否则全屏会有问题expandChartFullScreen
|
m_svg.createText(
|
attrAxisTitleH,
|
styleAxisTitleH,
|
content,
|
10,
|
null,
|
transform
|
);
|
}
|
|
//
|
for (
|
var i = 0;
|
i <= m_coordinatePara.EndLineNoH - m_coordinatePara.StartLineNoH;
|
i++
|
) {
|
var posiY_grid =
|
m_chartSize.PanelH.Bottom - m_chartSize.UpDiagram.SpaceGridY * i;
|
|
//主刻度
|
var valueMain = [];
|
valueMain.push(
|
"M ",
|
m_chartSize.DiagramLeft,
|
" ",
|
posiY_grid,
|
" L ",
|
m_chartSize.DiagramLeft - tickLength,
|
" ",
|
posiY_grid
|
);
|
m_svg.createPath(null, valueMain.join(""), attrAxisTickH, null);
|
|
//文字
|
var attrAxisLabelH = {
|
opacity: 1,
|
x: m_chartSize.DiagramLeft - 10,
|
y: posiY_grid + 5,
|
"text-anchor": "end",
|
};
|
var axis_h = UnitHelper.ConvertH_fromM(
|
m_unit.H,
|
m_coordinatePara.DispMinH + i * m_coordinatePara.SpaceH
|
);
|
if (axis_h < -0.01) continue;
|
var content = UnitHelper.valueFormat(axis_h);
|
m_svg.createText(attrAxisLabelH, styleAxisLabelH, content);
|
|
//子刻度线
|
if (
|
m_displayStyle.isDispMiniTick &&
|
i != m_coordinatePara.EndLineNoH - m_coordinatePara.StartLineNoH
|
) {
|
for (var j = 1; j <= m_displayStyle.MiniTickNumber; j++) {
|
var pois_minTick =
|
posiY_grid -
|
(m_chartSize.UpDiagram.SpaceGridY * j) /
|
(m_displayStyle.MiniTickNumber + 1);
|
var valueMini = [];
|
valueMini.push(
|
"M ",
|
m_chartSize.DiagramLeft,
|
" ",
|
pois_minTick,
|
" L ",
|
m_chartSize.DiagramLeft - minTickLength,
|
" ",
|
pois_minTick
|
);
|
m_svg.createPath(null, valueMini.join(""), attrAxisTickH, null);
|
}
|
}
|
}
|
}
|
|
//效率
|
if (
|
m_coordinatePara.EndLineNoE > m_coordinatePara.StartLineNoE &&
|
m_isDispCurveQE
|
) {
|
//刻度线
|
var attrAxisTickE = {
|
stroke: m_displayStyle.ColorE,
|
"stroke-width": "1",
|
fill: "none",
|
};
|
|
//刻度文字
|
var styleAxisLabelE =
|
"font-size:10px; fill-opacity:1; fill:" + m_displayStyle.ColorE + ";";
|
//标签
|
var styleAxisTitleE =
|
"font-size:14px; ;fill-opacity:1; font-weight:bold; fill:" +
|
m_displayStyle.ColorE +
|
";";
|
//
|
var attrAxisTitleE = {
|
opacity: 1,
|
x: m_chartSize.DiagramRight + 44,
|
y: (m_chartSize.UpDiagram.Bottom + m_chartSize.UpDiagram.Up) / 2 - 10,
|
"text-anchor": "middle",
|
};
|
|
//标签
|
if (m_localizationType == 0) {
|
//中文
|
attrAxisTitleE.y = attrAxisTitleE.y - 5;
|
m_svg.createText(attrAxisTitleE, styleAxisTitleE, "效");
|
attrAxisTitleE.y = attrAxisTitleE.y + 15;
|
m_svg.createText(attrAxisTitleE, styleAxisTitleE, "率");
|
|
attrAxisTitleE.x = attrAxisTitleE.x + 6;
|
attrAxisTitleE.y = attrAxisTitleE.y + 24;
|
var transform =
|
"rotate(-90 " + attrAxisTitleE.x + "," + attrAxisTitleE.y + ")";
|
m_svg.createText(
|
attrAxisTitleE,
|
styleAxisTitleE,
|
"(%)",
|
10,
|
null,
|
transform
|
);
|
} else {
|
attrAxisTitleE.x = attrAxisTitleE.x + 6;
|
attrAxisTitleE.y = attrAxisTitleE.y + 24;
|
var transform =
|
"rotate(-90 " + attrAxisTitleE.x + "," + attrAxisTitleE.y + ")";
|
m_svg.createText(
|
attrAxisTitleE,
|
styleAxisTitleE,
|
"Eta (%)",
|
10,
|
null,
|
transform
|
);
|
}
|
|
//
|
for (
|
var i = 0;
|
i <= m_coordinatePara.EndLineNoE - m_coordinatePara.StartLineNoE;
|
i++
|
) {
|
var posiY_grid =
|
m_chartSize.PanelE.Bottom - m_chartSize.UpDiagram.SpaceGridY * i;
|
//主刻度
|
var valueMain = [];
|
valueMain.push(
|
"M ",
|
m_chartSize.DiagramRight,
|
" ",
|
posiY_grid,
|
" L ",
|
m_chartSize.DiagramRight + tickLength,
|
" ",
|
posiY_grid
|
);
|
m_svg.createPath(null, valueMain.join(""), attrAxisTickE, null);
|
|
//文字
|
var attrAxisLabelE = {
|
opacity: 1,
|
x: m_chartSize.DiagramRight + 10,
|
y: posiY_grid + 5,
|
};
|
var axis_e =
|
m_coordinatePara.MinE +
|
(i + m_coordinatePara.StartLineNoE) * m_coordinatePara.SpaceE;
|
if (axis_e < -0.01) continue;
|
|
var content = UnitHelper.valueFormat(axis_e);
|
m_svg.createText(attrAxisLabelE, styleAxisLabelE, content);
|
|
//子刻度线
|
if (
|
m_displayStyle.isDispMiniTick &&
|
i != m_coordinatePara.EndLineNoE - m_coordinatePara.StartLineNoE
|
) {
|
for (var j = 0; j < m_displayStyle.MiniTickNumber; j++) {
|
var pois_minTick =
|
posiY_grid -
|
(m_chartSize.UpDiagram.SpaceGridY * j) /
|
m_displayStyle.MiniTickNumber;
|
var valueMini = [];
|
valueMini.push(
|
"M ",
|
m_chartSize.DiagramRight,
|
" ",
|
pois_minTick,
|
" L ",
|
m_chartSize.DiagramRight + minTickLength,
|
" ",
|
pois_minTick
|
);
|
m_svg.createPath(null, valueMini.join(""), attrAxisTickE, null);
|
}
|
}
|
}
|
}
|
|
//功率
|
if (m_coordinatePara.EndLineNoP > m_coordinatePara.StartLineNoP) {
|
//刻度线
|
var attrAxisTickP = {
|
stroke: m_displayStyle.ColorP,
|
"stroke-width": "1",
|
fill: "none",
|
};
|
|
let unit_p_name = UnitHelper.GetUnitNameP(m_unit.P);
|
|
//刻度文字
|
var styleAxisLabelP =
|
"font-size:10px; fill-opacity:1; fill:" + m_displayStyle.ColorP + ";";
|
//标签
|
var styleAxisTitleP =
|
"font-size:14px; ;fill-opacity:1; font-weight:bold; fill:" +
|
m_displayStyle.ColorP +
|
";";
|
|
//标签
|
if (m_localizationType == 0) {
|
//中文
|
var attrAxisTitleP = {
|
opacity: 1,
|
x: m_chartSize.DiagramLeft - 52,
|
y: (m_chartSize.PanelP.Bottom + m_chartSize.PanelP.Up) / 2 - 10,
|
"text-anchor": "middle",
|
};
|
if (m_coordinatePara.SpaceP <= 0.1) {
|
attrAxisTitleP.x = attrAxisTitleP.x - 5;
|
}
|
attrAxisTitleP.y = attrAxisTitleP.y - 5;
|
m_svg.createText(attrAxisTitleP, styleAxisTitleP, "功");
|
attrAxisTitleP.y = attrAxisTitleP.y + 15;
|
m_svg.createText(attrAxisTitleP, styleAxisTitleP, "率");
|
|
attrAxisTitleP.x = attrAxisTitleP.x + 2;
|
attrAxisTitleP.y = attrAxisTitleP.y + 25;
|
var transform =
|
"rotate(-90 " + attrAxisTitleP.x + "," + attrAxisTitleP.y + ")";
|
m_svg.createText(
|
attrAxisTitleP,
|
styleAxisTitleP,
|
"(" + unit_p_name + ")",
|
10,
|
null,
|
transform
|
);
|
} else {
|
var attrAxisTitleP = {
|
opacity: 1,
|
x: m_chartSize.DiagramLeft - 60,
|
y: (m_chartSize.PanelP.Bottom + m_chartSize.PanelP.Up) / 2 - 10,
|
"text-anchor": "middle",
|
};
|
if (m_coordinatePara.SpaceP <= 0.1) {
|
attrAxisTitleP.x = attrAxisTitleP.x - 5;
|
}
|
attrAxisTitleP.x = attrAxisTitleP.x + 13;
|
attrAxisTitleP.y = attrAxisTitleP.y + 25;
|
var transform =
|
"rotate(-90 " + attrAxisTitleP.x + "," + attrAxisTitleP.y + ")";
|
m_svg.createText(
|
attrAxisTitleP,
|
styleAxisTitleP,
|
"Power (" + unit_p_name + ")",
|
10,
|
null,
|
transform
|
);
|
}
|
|
//
|
for (
|
var i = 0;
|
i <= m_coordinatePara.EndLineNoP - m_coordinatePara.StartLineNoP;
|
i++
|
) {
|
var posiY_grid =
|
m_chartSize.PanelP.Bottom - m_chartSize.DownDiagram.SpaceGridY * i;
|
//主刻度
|
var valueMain = [];
|
valueMain.push(
|
"M ",
|
m_chartSize.DiagramLeft,
|
" ",
|
posiY_grid,
|
" L ",
|
m_chartSize.DiagramLeft - tickLength,
|
" ",
|
posiY_grid
|
);
|
m_svg.createPath(null, valueMain.join(""), attrAxisTickP, null);
|
|
//文字
|
var attrAxisLabelP = {
|
opacity: 1,
|
x: m_chartSize.DiagramLeft - 10,
|
y: posiY_grid + 5,
|
"text-anchor": "end",
|
};
|
|
var aixs_p = UnitHelper.ConvertP_fromKW(
|
m_unit.P,
|
m_coordinatePara.MinP +
|
(i + m_coordinatePara.StartLineNoP) * m_coordinatePara.SpaceP
|
);
|
aixs_p = UnitHelper.getDispValueP(aixs_p);
|
if (aixs_p < -0.01) continue;
|
var content = aixs_p.toString();
|
m_svg.createText(attrAxisLabelP, styleAxisLabelP, content);
|
|
//子刻度线
|
if (
|
m_displayStyle.isDispMiniTick &&
|
i != m_coordinatePara.EndLineNoP &&
|
i != m_coordinatePara.EndLineNoP - m_coordinatePara.StartLineNoP
|
) {
|
for (var j = 1; j < m_displayStyle.MiniTickNumber; j++) {
|
var pois_minTick =
|
posiY_grid -
|
(m_chartSize.DownDiagram.SpaceGridY * j) /
|
m_displayStyle.MiniTickNumber;
|
var valueMini = [];
|
valueMini.push(
|
"M ",
|
m_chartSize.DiagramLeft,
|
" ",
|
pois_minTick,
|
" L ",
|
m_chartSize.DiagramLeft - minTickLength,
|
" ",
|
pois_minTick
|
);
|
m_svg.createPath(null, valueMini.join(""), attrAxisTickP, null);
|
}
|
}
|
}
|
}
|
|
//汽蚀
|
if (
|
m_isHaveNpsh &&
|
m_isDispCurveNPSH &&
|
m_coordinatePara.EndLineNoNPSH > m_coordinatePara.StartLineNoNPSH
|
) {
|
//刻度线
|
var attrAxisTickNPSH = {
|
stroke: m_displayStyle.ColorNPSH,
|
"stroke-width": "1",
|
fill: "none",
|
};
|
|
//刻度文字
|
var styleAxisLabelNPSH =
|
"font-size:10px; fill-opacity:1; fill:" +
|
m_displayStyle.ColorNPSH +
|
";";
|
//标签
|
var styleAxisTitleNPSH =
|
"font-size:14px; ;fill-opacity:1; font-weight:bold; fill:" +
|
m_displayStyle.ColorNPSH +
|
";";
|
|
//标签
|
var attrAxisTitleNPSH = {
|
opacity: 1,
|
x: m_chartSize.DiagramRight + 44,
|
y: (m_chartSize.PanelNPSH.Bottom + m_chartSize.PanelNPSH.Up) / 2 - 10,
|
"text-anchor": "middle",
|
};
|
var unit_npsh_str = "(" + UnitHelper.GetUnitNameNPSH(m_unit.NPSH) + ")";
|
if (m_localizationType == 0) {
|
//中文
|
attrAxisTitleNPSH.y = attrAxisTitleNPSH.y - 5;
|
m_svg.createText(attrAxisTitleNPSH, styleAxisTitleNPSH, "汽");
|
attrAxisTitleNPSH.y = attrAxisTitleNPSH.y + 15;
|
m_svg.createText(attrAxisTitleNPSH, styleAxisTitleNPSH, "蚀");
|
attrAxisTitleNPSH.x = attrAxisTitleNPSH.x - 4;
|
attrAxisTitleNPSH.y = attrAxisTitleNPSH.y + 24;
|
var transform =
|
"rotate(90 " + attrAxisTitleNPSH.x + "," + attrAxisTitleNPSH.y + ")";
|
m_svg.createText(
|
attrAxisTitleNPSH,
|
styleAxisTitleNPSH,
|
unit_npsh_str,
|
10,
|
null,
|
transform
|
);
|
} else {
|
attrAxisTitleNPSH.x = attrAxisTitleNPSH.x + 6;
|
attrAxisTitleNPSH.y = attrAxisTitleNPSH.y + 24;
|
var transform =
|
"rotate(90 " + attrAxisTitleNPSH.x + "," + attrAxisTitleNPSH.y + ")";
|
m_svg.createText(
|
attrAxisTitleNPSH,
|
styleAxisTitleNPSH,
|
"NPSHr " + unit_npsh_str,
|
10,
|
null,
|
transform
|
);
|
}
|
|
//
|
for (
|
var i = 0;
|
i <= m_coordinatePara.EndLineNoNPSH - m_coordinatePara.StartLineNoNPSH;
|
i++
|
) {
|
var posiY_grid =
|
m_chartSize.PanelNPSH.Bottom - m_chartSize.DownDiagram.SpaceGridY * i;
|
//主刻度
|
var valueMain = [];
|
valueMain.push(
|
"M ",
|
m_chartSize.DiagramRight,
|
" ",
|
posiY_grid,
|
" L ",
|
m_chartSize.DiagramRight + tickLength,
|
" ",
|
posiY_grid
|
);
|
m_svg.createPath(null, valueMain.join(""), attrAxisTickNPSH, null);
|
|
//文字
|
var attrAxisLabelNPSH = {
|
opacity: 1,
|
x: m_chartSize.DiagramRight + 10,
|
y: posiY_grid + 5,
|
};
|
var axis_npsh =
|
m_coordinatePara.MinNPSH +
|
(i + m_coordinatePara.StartLineNoNPSH) * m_coordinatePara.SpaceNPSH;
|
axis_npsh = UnitHelper.ConvertNPSH_fromM(m_unit.NPSH, axis_npsh);
|
if (axis_npsh < -0.01) continue;
|
var content = UnitHelper.valueFormat(axis_npsh);
|
m_svg.createText(attrAxisLabelNPSH, styleAxisLabelNPSH, content);
|
|
//子刻度线
|
if (
|
m_displayStyle.isDispMiniTick &&
|
i != m_coordinatePara.EndLineNoNPSH - m_coordinatePara.StartLineNoNPSH
|
) {
|
for (var j = 0; j < m_displayStyle.MiniTickNumber; j++) {
|
var pois_minTick =
|
posiY_grid -
|
(m_chartSize.DownDiagram.SpaceGridY * j) /
|
m_displayStyle.MiniTickNumber;
|
var valueMini = [];
|
valueMini.push(
|
"M ",
|
m_chartSize.DiagramRight,
|
" ",
|
pois_minTick,
|
" L ",
|
m_chartSize.DiagramRight + minTickLength,
|
" ",
|
pois_minTick
|
);
|
m_svg.createPath(null, valueMini.join(""), attrAxisTickNPSH, null);
|
}
|
}
|
}
|
}
|
};
|
//绘制面板
|
var drawDiagramPanel = function () {
|
if (m_chartDiagramPanelStyle == ConstParas.ChartDiagramPanelStyle.Whole) {
|
//绘制网格线
|
createGridLineDiagram_Whole();
|
|
//绘制X坐标
|
createXAxis(m_chartSize.DownDiagram.Bottom, 40);
|
|
//绘制Y坐标
|
createYAxis_Whole();
|
} else {
|
//绘制网格线
|
createGridLineDiagram_TwoPanel();
|
|
//绘制X坐标
|
createXAxis(m_chartSize.UpDiagram.Bottom, 0);
|
createXAxis(m_chartSize.DownDiagram.Bottom, 40);
|
|
//绘制Y坐标
|
createYAxis_TwoPanel();
|
}
|
};
|
|
|
//绘制曲线(流量扬程)
|
var createCurveQH = function (
|
curveElementName,
|
curvePoints,
|
curveWidth,
|
curveColor,
|
curveIsDisp,
|
curveDashType
|
) {
|
if (curvePoints == null) {
|
return;
|
}
|
if (curveElementName == null) {
|
return;
|
}
|
|
var pixelPoints = [];
|
for (var v = 0; v < curvePoints.length; v++) {
|
var pt = curvePoints[v];
|
var x = getPixelValueQ(pt.X);
|
var y = getPixelValueH(pt.Y);
|
pixelPoints.push({ X: x, Y: y });
|
}
|
|
return createCurveQH_pixel(
|
curveElementName,
|
pixelPoints,
|
curveWidth,
|
curveColor,
|
curveIsDisp,
|
curveDashType
|
);
|
};
|
//绘制曲线(流量扬程) : 像素点
|
var createCurveQH_pixel = function (
|
curveElementName,
|
pixelPoints,
|
curveWidth,
|
curveColor,
|
isDisp,
|
curveDashType
|
) {
|
if (pixelPoints == null || pixelPoints.length < 3) {
|
return;
|
}
|
if (curveElementName == null) {
|
return;
|
}
|
var pathValue = transBezierCurveToPath(pixelPoints);
|
if (pathValue == null || pathValue == undefined) return;
|
//有时会报错
|
if (pathValue.toString().indexOf("M ,NaN, ,NaN") == 0) {
|
return;
|
}
|
|
var style = {
|
"stroke-width": "2px",
|
stroke: m_displayStyle.ColorH,
|
fill: "none",
|
"fill-opacity": "0.5",
|
//"stroke-dasharray":"5 3",
|
"shape-rendering": "geometricPrecision",
|
"zIndex:": 7,
|
};
|
if (curveWidth != null) {
|
style["stroke-width"] = curveWidth;
|
}
|
if (curveColor != null) {
|
style["stroke"] = curveColor;
|
}
|
if (curveDashType != null) {
|
style["stroke-dasharray"] = curveDashType; //'10, 10';//'10, 10, 5, 5'
|
}
|
//绘制
|
m_svg.createPath(
|
curveElementName,
|
pathValue.join(""),
|
{
|
id: curveElementName,
|
},
|
style
|
);
|
//是否显示
|
if (isDisp != null && !isDisp) {
|
hideElementById(curveElementName);
|
}
|
|
//绘制定义点
|
/*pixelPoints.forEach(pixel_pt => {
|
|
var attr_pt = {
|
"cx": pixel_pt.X,
|
"cy": pixel_pt.Y,
|
"r": 2
|
}
|
var style_pt = {
|
"stroke-width": "2px",
|
"stroke": curveColor,
|
"fill": "none",
|
"fill-opacity": "0.5",
|
"shape-rendering": "geometricPrecision",
|
"zIndex:": 7
|
};
|
|
|
m_svg.createCircle(null, attr_pt, style_pt);
|
});*/
|
|
return pixelPoints;
|
};
|
//绘制直线
|
var createLineQH = function (
|
curveElementName,
|
point1,
|
point2,
|
curveWidth,
|
curveColor,
|
objTag
|
) {
|
if (point1 == null || point2 == null) {
|
return;
|
}
|
if (curveElementName == null) {
|
return;
|
}
|
var x1 = getPixelValueQ(point1.X);
|
var y1 = getPixelValueH(point1.Y);
|
|
var x2 = getPixelValueQ(point2.X);
|
var y2 = getPixelValueH(point2.Y);
|
|
var style = {
|
"stroke-width": "2px",
|
stroke: m_displayStyle.ColorH,
|
fill: "none",
|
"fill-opacity": "0.5",
|
//"stroke-dasharray":"5 3",
|
"shape-rendering": "geometricPrecision",
|
"zIndex:": 7,
|
};
|
if (curveWidth != null) {
|
style["stroke-width"] = curveWidth;
|
}
|
if (curveColor != null) {
|
style["stroke"] = curveColor;
|
}
|
var temp = "M x1 y1 L x2 y2";
|
var pathValue = temp
|
.replace("x1", x1)
|
.replace("y1", y1)
|
.replace("x2", x2)
|
.replace("y2", y2);
|
if (objTag == null)
|
m_svg.createPath(curveElementName, pathValue, null, style);
|
else m_svg.createPath(curveElementName, pathValue, { tag: objTag }, style);
|
};
|
//绘制点
|
var createPointQH = function (
|
curveElementName,
|
point,
|
circleSize,
|
circleColor
|
) {
|
if (point == null) {
|
return;
|
}
|
if (curveElementName == null) {
|
return;
|
}
|
|
var xPixel = getPixelValueQ(point.X);
|
var yPixel = getPixelValueH(point.Y);
|
|
var attr = {
|
cx: xPixel,
|
cy: yPixel,
|
r: 2,
|
};
|
var style = {
|
"stroke-width": "2px",
|
stroke: m_displayStyle.ColorH,
|
fill: "none",
|
"fill-opacity": "0.5",
|
//"stroke-dasharray":"5 3",
|
"shape-rendering": "geometricPrecision",
|
"zIndex:": 7,
|
};
|
if (circleSize != null) {
|
attr.r = circleSize;
|
}
|
if (circleColor != null) {
|
style["stroke"] = circleColor;
|
}
|
|
m_svg.createCircle(curveElementName, attr, style);
|
};
|
//绘制文字 textAnchor 文字对齐 start | middle | end
|
var drawTextByQH = function (
|
curveElementName,
|
text,
|
point,
|
textSize,
|
textColor,
|
offsetPixelX,
|
offsetPixelY,
|
textAnchor
|
) {
|
if (!text) {
|
return;
|
}
|
if (!point) {
|
return;
|
}
|
|
var xPixel = getPixelValueQ(point.X);
|
var yPixel = getPixelValueH(point.Y);
|
if (offsetPixelX != null) {
|
xPixel += offsetPixelX;
|
}
|
if (offsetPixelY != null) {
|
yPixel -= offsetPixelY;
|
}
|
|
var textStyle = "stroke-width:1px; "; //font-weight:bold; fill-opacity:0.9;
|
if (textColor != null) {
|
textStyle += " fill:" + textColor + ";";
|
} else {
|
textStyle += " fill:#000000;";
|
}
|
if (textSize != null) {
|
textStyle += " font-size:" + textSize + "px;";
|
} else {
|
textStyle += " font-size:12px;";
|
}
|
if (textAnchor != null) {
|
textStyle += " text-anchor:" + textAnchor + ";";
|
}
|
if (curveElementName == null) {
|
return m_svg.createText(
|
{
|
opacity: 0.5,
|
y: yPixel,
|
x: xPixel,
|
},
|
textStyle,
|
text
|
);
|
} else {
|
return m_svg.createText(
|
{
|
id: curveElementName,
|
opacity: 0.5,
|
y: yPixel,
|
x: xPixel,
|
},
|
textStyle,
|
text
|
);
|
}
|
};
|
//文字
|
var drawCurveTextByQH = function (curveElementName, curveInfo, point) {
|
if (!point) {
|
return;
|
}
|
|
var xPixel = getPixelValueQ(point.X) + 9;
|
var yPixel = getPixelValueH(point.Y) + 4;
|
|
var textStyleText = "font-size:11px;text-anchor:start;font-family:sans-serif;"; //fill-opacity:0.9 stroke-width:1px;
|
textStyleText += " fill:white;";
|
|
var attr_circle = {
|
"cx": xPixel+3,
|
"cy": yPixel-3,
|
"r": 8
|
}
|
var style_circle = {
|
"stroke-width": "2px",
|
"stroke": "none" ,
|
"fill": curveInfo.color ,
|
"fill-opacity": "0.9",
|
"shape-rendering": "geometricPrecision",
|
"zIndex:": 7
|
};
|
|
|
m_svg.createCircle(null, attr_circle, style_circle);
|
|
|
|
|
return m_svg.createText(
|
{
|
id: curveElementName,
|
opacity: 0.5,
|
y: yPixel,
|
x: xPixel,
|
},
|
textStyleText,
|
curveInfo.capture
|
);
|
};
|
var drawCurveTextByQP = function (
|
curveElementName,
|
curveInfo,
|
point
|
) {
|
if (!point) {
|
return;
|
}
|
|
var xPixel = getPixelValueQ(point.X) + 9;
|
var yPixel = getPixelValueP(point.Y) + 4;
|
|
|
var textStyleText = "font-size:11px;text-anchor:start;font-family:sans-serif;fill:white;"; //fill-opacity:0.9 stroke-width:1px;
|
|
|
var attr_circle = {
|
"cx": xPixel+3,
|
"cy": yPixel-3,
|
"r": 8
|
}
|
var style_circle = {
|
"stroke-width": "2px",
|
"stroke": "none" ,
|
"fill": curveInfo.color ,
|
"fill-opacity": "0.9",
|
"shape-rendering": "geometricPrecision",
|
"zIndex:": 7
|
};
|
|
|
m_svg.createCircle(null, attr_circle, style_circle);
|
|
|
|
return m_svg.createText(
|
{
|
id: curveElementName,
|
opacity: 0.5,
|
y: yPixel,
|
x: xPixel,
|
},
|
textStyleText,
|
curveInfo.capture
|
);
|
};
|
|
|
//绘制曲线(流量效率)
|
var createCurveQE = function (
|
curveElementName,
|
points,
|
curveWidth,
|
curveColor,
|
curveIsDisp,
|
curveDashType
|
) {
|
if (points == null) {
|
return null;
|
}
|
if (curveElementName == null) {
|
return null;
|
}
|
var isForceZeroPt = true;
|
if (curveElementName == "RegionBlodCurveQE_Allow") isForceZeroPt = false;
|
if (curveElementName == "PerferBlodCurveQE_Allow") isForceZeroPt = false;
|
|
var pixelPoints = [];
|
for (var v = 0; v < points.length; v++) {
|
if (isForceZeroPt && v == 0 && points[0].X < 10) {
|
//强制归零
|
points[0].X = 0;
|
points[0].Y = 0;
|
}
|
var pt = points[v];
|
var x = getPixelValueQ(pt.X);
|
var y = getPixelValueE(pt.Y);
|
pixelPoints.push({ X: x, Y: y });
|
}
|
|
return createCurveQE_pixel(
|
curveElementName,
|
pixelPoints,
|
curveWidth,
|
curveColor,
|
curveIsDisp,
|
curveDashType
|
);
|
};
|
//绘制曲线(流量效率) : 像素点
|
var createCurveQE_pixel = function (
|
curveElementName,
|
pixelPoints,
|
curveWidth,
|
curveColor,
|
isDisp,
|
curveDashType
|
) {
|
if (pixelPoints == null || pixelPoints.length < 3) {
|
return null;
|
}
|
if (curveElementName == null) {
|
return null;
|
}
|
var pathValue = transBezierCurveToPath(pixelPoints);
|
if (pathValue == null || pathValue == undefined) return null;
|
//有时会报错,加上这个就没事 tangxu 20151122
|
if (pathValue.toString().indexOf("M ,NaN, ,NaN") == 0) {
|
return null;
|
}
|
var style = {
|
"stroke-width": "2px",
|
stroke: m_displayStyle.ColorE,
|
fill: "none",
|
"fill-opacity": "0.5",
|
//"stroke-dasharray":"5 3",
|
"shape-rendering": "geometricPrecision",
|
"zIndex:": 7,
|
};
|
if (curveWidth != null) {
|
style["stroke-width"] = curveWidth;
|
}
|
if (curveColor != null) {
|
style["stroke"] = curveColor;
|
}
|
|
if (curveDashType != null) {
|
style["stroke-dasharray"] = curveDashType; //'10, 10';//'10, 10, 5, 5'
|
}
|
|
m_svg.createPath(
|
curveElementName,
|
pathValue.join(""),
|
{
|
id: curveElementName,
|
},
|
style
|
);
|
if (isDisp != null && !isDisp) {
|
hideElementById(curveElementName);
|
}
|
return pixelPoints;
|
};
|
//绘制曲线(流量功率)
|
var createCurveQP = function (
|
curveElementName,
|
points,
|
curveWidth,
|
curveColor,
|
curveIsDisp,
|
curveDashType
|
) {
|
if (points == null) {
|
return null;
|
}
|
if (curveElementName == null) {
|
return null;
|
}
|
|
var pixelPoints = [];
|
for (var v = 0; v < points.length; v++) {
|
var pt = points[v];
|
var x = getPixelValueQ(pt.X);
|
var y = getPixelValueP(pt.Y);
|
pixelPoints.push({ X: x, Y: y });
|
}
|
return createCurveQP_pixel(
|
curveElementName,
|
pixelPoints,
|
curveWidth,
|
curveColor,
|
curveIsDisp,
|
curveDashType
|
);
|
};
|
//绘制曲线(流量功率) : 像素点
|
var createCurveQP_pixel = function (
|
curveElementName,
|
pixelPoints,
|
curveWidth,
|
curveColor,
|
curveIsDisp,
|
curveDashType
|
) {
|
if (pixelPoints == null || pixelPoints.length < 3) {
|
return null;
|
}
|
if (curveElementName == null) {
|
return null;
|
}
|
var pathValue = transBezierCurveToPath(pixelPoints);
|
if (pathValue == null || pathValue == undefined) return null;
|
//有时会报错,加上这个就没事 tangxu 20151122
|
if (pathValue.toString().indexOf("M ,NaN, ,NaN") == 0) {
|
return null;
|
}
|
var style = {
|
"stroke-width": "2px",
|
stroke: m_displayStyle.ColorP,
|
fill: "none",
|
"fill-opacity": "0.5",
|
//"stroke-dasharray":"5 3",
|
"shape-rendering": "geometricPrecision",
|
"zIndex:": 7,
|
};
|
if (curveWidth != null) {
|
style["stroke-width"] = curveWidth;
|
}
|
if (curveColor != null) {
|
style["stroke"] = curveColor;
|
}
|
//m_svg.createPath(curveElementName, pathValue.join(''), {
|
// "id": curveElementName
|
//}, style);
|
if (curveDashType != null) {
|
style["stroke-dasharray"] = curveDashType; //'10, 10';//'10, 10, 5, 5'
|
}
|
|
m_svg.createPath(
|
curveElementName,
|
pathValue.join(""),
|
{
|
id: curveElementName,
|
},
|
style
|
);
|
if (curveIsDisp != null && !curveIsDisp) {
|
hideElementById(curveElementName);
|
}
|
|
return pixelPoints;
|
};
|
//绘制曲线(流量汽蚀)
|
var createCurveNPSH = function (
|
curveElementName,
|
points,
|
curveWidth,
|
curveColor,
|
curveIsDisp,
|
curveDashType
|
) {
|
if (points == null || m_coordinatePara.SpaceNPSH < 0.02) {
|
return null;
|
}
|
if (curveElementName == null) {
|
return null;
|
}
|
|
var pixelPoints = [];
|
for (var v = 0; v < points.length; v++) {
|
var pt = points[v];
|
var x = getPixelValueQ(pt.X);
|
var y = getPixelValueNPSH(pt.Y);
|
pixelPoints.push({ X: x, Y: y });
|
}
|
|
return createCurveNPSH_pixel(
|
curveElementName,
|
pixelPoints,
|
curveWidth,
|
curveColor,
|
curveIsDisp,
|
curveDashType
|
);
|
};
|
//绘制曲线(流量功率) : 像素点
|
var createCurveNPSH_pixel = function (
|
curveElementName,
|
pixelPoints,
|
curveWidth,
|
curveColor,
|
curveIsDisp,
|
curveDashType
|
) {
|
if (pixelPoints == null || pixelPoints.length < 3) {
|
return null;
|
}
|
if (curveElementName == null) {
|
return null;
|
}
|
var pathValue = transBezierCurveToPath(pixelPoints);
|
if (pathValue == null || pathValue == undefined) return;
|
//有时会报错,加上这个就没事 tangxu 20151122
|
if (pathValue.toString().indexOf("M ,NaN, ,NaN") == 0) {
|
return;
|
}
|
var style = {
|
"stroke-width": "2px",
|
stroke: m_displayStyle.ColorNPSH,
|
fill: "none",
|
"fill-opacity": "0.5",
|
//"stroke-dasharray":"5 3",
|
"shape-rendering": "geometricPrecision",
|
"zIndex:": 7,
|
};
|
if (curveWidth != null) {
|
style["stroke-width"] = curveWidth;
|
}
|
if (curveColor != null) {
|
style["stroke"] = curveColor;
|
}
|
if (curveDashType != null) {
|
style["stroke-dasharray"] = curveDashType; //'10, 10';//'10, 10, 5, 5'
|
}
|
m_svg.createPath(
|
curveElementName,
|
pathValue.join(""),
|
{
|
id: curveElementName,
|
},
|
style
|
);
|
if (curveIsDisp != null && !curveIsDisp) {
|
hideElementById(curveElementName);
|
}
|
};
|
//清理
|
var ClearCurveElement = function () { };
|
|
|
//绘制水印(图片)
|
var drawLogoWaterMark = function () {
|
var watermark_img_url = "static/img/watermark.png";
|
|
removeElementById("conWaterMarkImage1");
|
removeElementById("conWaterMarkImage2");
|
removeElementById("conWaterMarkImage3");
|
removeElementById("conWaterMarkImage4");
|
|
var img_watermark = new Image();
|
img_watermark.src = watermark_img_url;
|
img_watermark.onload = function () {
|
var watermark_image_width_real = img_watermark.width;
|
var watermark_image_height_real = img_watermark.height;
|
|
|
var ratio_byHeight =
|
(m_chartSize.TotalHeight * 0.2) / watermark_image_height_real;
|
var ratio_byWidth =
|
(m_chartSize.TotalWidth * 0.2) / watermark_image_width_real;
|
|
var ratio_waterMark = Math.min(ratio_byHeight, ratio_byWidth);
|
|
var watermark_image_width = watermark_image_width_real * ratio_waterMark;
|
var watermark_image_height =
|
watermark_image_height_real * ratio_waterMark;
|
|
var logoStyle =
|
"-webkit-transform: rotate(5deg);-moz-transform: rotate(5deg);transform: rotate(15deg);fill:#000000;fill-opacity:0.6;font-weight:bold;stroke-width:1px;font-size:16px;z-index:0";
|
var logoPosi1 = {
|
opacity: 0.9,
|
y: (m_chartSize.TotalHeight * 1) / 4 - watermark_image_height / 2,
|
x: (m_chartSize.TotalWidth * 1) / 4 - watermark_image_width / 2,
|
width: watermark_image_width,
|
height: watermark_image_height,
|
};
|
m_svg.createImage(
|
logoPosi1,
|
logoStyle,
|
"conWaterMarkImage1",
|
watermark_img_url
|
);
|
|
var logoPosi2 = {
|
opacity: 0.9,
|
y: (m_chartSize.TotalHeight * 3) / 4 - watermark_image_height / 2,
|
x: (m_chartSize.TotalWidth * 1) / 4 - watermark_image_width / 2,
|
width: watermark_image_width,
|
height: watermark_image_height,
|
};
|
m_svg.createImage(
|
logoPosi2,
|
logoStyle,
|
"conWaterMarkImage2",
|
watermark_img_url
|
);
|
|
var logoPosi3 = {
|
opacity: 0.9,
|
y: (m_chartSize.TotalHeight * 1) / 4 - watermark_image_height / 2,
|
x: (m_chartSize.TotalWidth * 3) / 4 - watermark_image_width / 2,
|
width: watermark_image_width,
|
height: watermark_image_height,
|
};
|
m_svg.createImage(
|
logoPosi3,
|
logoStyle,
|
"conWaterMarkImage3",
|
watermark_img_url
|
);
|
|
var logoPosi4 = {
|
opacity: 0.9,
|
y: (m_chartSize.TotalHeight * 3) / 4 - watermark_image_height / 2,
|
x: (m_chartSize.TotalWidth * 3) / 4 - watermark_image_width / 2,
|
width: watermark_image_width,
|
height: watermark_image_height,
|
};
|
m_svg.createImage(
|
logoPosi4,
|
logoStyle,
|
"conWaterMarkImage4",
|
watermark_img_url
|
);
|
};
|
};
|
|
//获取x在curve的(X Y)点值 (像素点)
|
var getBezierPointY = function (curve, x) {
|
if (curve == null) return null;
|
var iPtCount = curve.length;
|
|
if (x < curve[0].Point0.X - 1) {
|
return null;
|
}
|
if (x > curve[iPtCount - 1].Point3.X + 1) {
|
return null;
|
}
|
|
for (var i = 0; i < iPtCount; i++) {
|
if (x == curve[i].Point0.X) {
|
return {
|
X: curve[i].Point0.X,
|
Y: curve[i].Point0.Y,
|
};
|
}
|
if (x == curve[i].Point3.X) {
|
return {
|
X: curve[i].Point3.X,
|
Y: curve[i].Point3.Y,
|
};
|
}
|
if (x > curve[i].Point0.X && x < curve[i].Point3.X) {
|
var ptBizer = curve[i];
|
//
|
try {
|
var minDis = Math.abs(ptBizer.Point3.X - ptBizer.Point0.X);
|
var sectY = null;
|
var sectX = null;
|
for (var uu = 0; uu <= 1; uu = uu + 0.05) {
|
var x0 = ptBizer.Point0.X * uu * uu * uu;
|
var x1 = 3 * ptBizer.Point1.X * uu * uu * (1 - uu);
|
var x2 = 3 * ptBizer.Point2.X * uu * (1 - uu) * (1 - uu);
|
var x3 = ptBizer.Point3.X * (1 - uu) * (1 - uu) * (1 - uu);
|
|
var curveX = x0 + x1 + x2 + x3;
|
if (Math.abs(curveX - x) < minDis) {
|
var y0 = ptBizer.Point0.Y * uu * uu * uu;
|
var y1 = 3 * ptBizer.Point1.Y * uu * uu * (1 - uu);
|
var y2 = 3 * ptBizer.Point2.Y * uu * (1 - uu) * (1 - uu);
|
var y3 = ptBizer.Point3.Y * (1 - uu) * (1 - uu) * (1 - uu);
|
minDis = Math.abs(curveX - x);
|
sectY = y0 + y1 + y2 + y3;
|
sectX = curveX;
|
}
|
}
|
//
|
if (sectY != null && sectX != null) {
|
return {
|
X: sectX,
|
Y: sectY,
|
};
|
}
|
} catch (ex) {
|
//alert(ex.message);
|
console.log("getBezierPointY error", curve, x);
|
return null;
|
}
|
}
|
}
|
|
if (
|
x > curve[iPtCount - 1].Point3.X - 1 &&
|
x < curve[iPtCount - 1].Point3.X + 5
|
) {
|
return {
|
X: curve[iPtCount - 1].Point3.X,
|
Y: curve[iPtCount - 1].Point3.Y,
|
};
|
}
|
|
return null;
|
};
|
//获取x在curve的(X Y)点值 (像素点)
|
var getBezierPointX = function (curve, y) {
|
if (curve == null) return null;
|
var iPtCount = curve.length;
|
|
if (y < curve[0].Point0.Y && y < curve[iPtCount - 1].Point3.Y) {
|
return null;
|
}
|
if (y > curve[0].Point0.Y && y > curve[iPtCount - 1].Point3.Y) {
|
return null;
|
}
|
|
for (var i = 0; i < iPtCount; i++) {
|
var ptBizer = curve[i];
|
|
if (y < ptBizer.Point0.Y && y < ptBizer.Point3.Y) {
|
continue;
|
}
|
if (y > ptBizer.Point0.Y && y > ptBizer.Point3.Y) {
|
continue;
|
}
|
|
//
|
try {
|
var minDis = Math.abs(ptBizer.Point3.Y - ptBizer.Point0.Y);
|
|
var sectY = null;
|
var sectX = null;
|
for (var uu = 0; uu <= 1; uu = uu + 0.05) {
|
var x0 = ptBizer.Point0.X * uu * uu * uu;
|
var x1 = 3 * ptBizer.Point1.X * uu * uu * (1 - uu);
|
var x2 = 3 * ptBizer.Point2.X * uu * (1 - uu) * (1 - uu);
|
var x3 = ptBizer.Point3.X * (1 - uu) * (1 - uu) * (1 - uu);
|
|
var y0 = ptBizer.Point0.Y * uu * uu * uu;
|
var y1 = 3 * ptBizer.Point1.Y * uu * uu * (1 - uu);
|
var y2 = 3 * ptBizer.Point2.Y * uu * (1 - uu) * (1 - uu);
|
var y3 = ptBizer.Point3.Y * (1 - uu) * (1 - uu) * (1 - uu);
|
|
var curveX = x0 + x1 + x2 + x3;
|
var curveY = y0 + y1 + y2 + y3;
|
|
if (Math.abs(curveY - y) < minDis) {
|
minDis = Math.abs(curveY - y);
|
sectY = curveY;
|
sectX = curveX;
|
}
|
}
|
//
|
if (sectY != null && sectX != null) {
|
return {
|
X: sectX,
|
Y: sectY,
|
};
|
}
|
} catch (ex) {
|
//alert(ex.message);
|
return null;
|
}
|
}
|
|
return null;
|
};
|
//绘制查询竖直指导线
|
var drawQueryIndicatVertLine = function (xStartValuePixel,index) {
|
|
//
|
removeElementById("infoDv4VerticalLineConn1");
|
|
|
var obj_divChart = document.getElementById(m_divChartName);
|
|
//先创建用于放置查询信息的Div
|
var info_div1 = document.createElement("div");
|
info_div1.innerHTML = "<lable style='font-size:7px'>" + getTranslateString("流量") + "</label>";
|
info_div1.id = "infoDv4VerticalLineConn1";
|
info_div1.style.display = 'none';
|
info_div1.style.position = 'relative';
|
info_div1.style.color = 'gray';
|
info_div1.style.fontSize = '9px';
|
info_div1.style.textAlign = "left";
|
info_div1.style.width = "100px";
|
info_div1.style.left = (m_chartSize.DiagramRight - 130).toString() + "px";
|
info_div1.style.top = (22 - m_chartSize.TotalHeight).toString() + "px";
|
|
obj_divChart.appendChild(info_div1);
|
|
|
// var info_div2 = document.createElement("div");
|
// info_div2.innerHTML = "<lable style='font-size:7px'>" + getTranslateString("流量") + "</label>";
|
// info_div2.id = "infoDv4VerticalLineMs2";
|
// info_div2.style.display = 'none';
|
// info_div2.style.position = 'relative';
|
// info_div2.style.color = 'gray';
|
// info_div2.style.fontSize = '9px';
|
// info_div2.style.textAlign = "left";
|
// info_div2.style.width = "120px";
|
// info_div2.style.left = (m_chartSize.DiagramRight - 120).toString() + "px";
|
// info_div2.style.top = (120 - m_chartSize.TotalHeight).toString() + "px";
|
|
// obj_divChart.appendChild(info_div2);
|
|
|
|
var attr4verticalLine1 = {
|
"stroke": "rgb(136 136 221)",
|
"stroke-width": "3",
|
"fill": "none",
|
"zIndex": 100,
|
"stroke-dasharray": "18 3",
|
"cursor": 'pointer',
|
"stroke-opacity": '1',
|
"shape-rendering": "geometricPrecision",
|
};
|
|
// 位置
|
if (xStartValuePixel == null || xStartValuePixel < 1)
|
xStartValuePixel = (m_chartSize.DiagramLeft + m_chartSize.DiagramRight) / 2;
|
|
var vertialLinePathName1 = "verticalLineConn1";
|
removeElementById(vertialLinePathName1);
|
|
//创建竖直线
|
var pathValue1 = [];
|
pathValue1.push("M ", xStartValuePixel, " ", m_chartSize.UpDiagram.Up, " L ", xStartValuePixel, " ", m_chartSize.DownDiagram.Bottom);
|
m_svg.createPath(vertialLinePathName1, pathValue1.join(''), {
|
id: vertialLinePathName1
|
}, attr4verticalLine1, null);
|
|
// var pathValue2 = new Array();
|
// var vertialLinePathName2 = "verticalLine2multispeed";
|
// pathValue2.push("M ", xStartValuePixel, " ", m_chartSize.UpDiagram.Up, " L ", xStartValuePixel, " ", m_chartSize.DownDiagram.Bottom);
|
// m_svg.createPath(vertialLinePathName2, pathValue1.join(''), {
|
// id: vertialLinePathName2
|
// }, attr4verticalLine2, null);
|
|
|
drawQueryDataInfoByPixel(xStartValuePixel, 1);
|
//drawQueryDataInfoByPixel(xStartValuePixel, 2);
|
|
var isMoveVerticalLine1 = false;
|
var objIndicatorLine1 = document.getElementById(vertialLinePathName1);
|
objIndicatorLine1.onmousedown = function (e) {
|
isMoveVerticalLine1 = true;
|
e.preventDefault();
|
}
|
|
// var isMoveVerticalLine2 = false;
|
// var objIndicatorLine2 = document.getElementById("verticalLine2multispeed");
|
// objIndicatorLine2.onmousedown = function (e) {
|
// isMoveVerticalLine2 = true;
|
// e.preventDefault();
|
// }
|
|
obj_divChart.onmousemove = function (e) {
|
if (isMoveVerticalLine1 == true) {
|
if (objIndicatorLine1 == null)
|
return;
|
var svg_root = m_svg.getRootNode();
|
|
const box = svg_root.getBoundingClientRect();
|
var top = box.top + window.scrollY - document.documentElement.clientTop;
|
var left = box.left + window.scrollX - document.documentElement.clientLeft
|
var e = window.event || e;
|
if (e.clientX - left > m_chartSize.DiagramLeft &&
|
m_chartSize.DiagramRight + left - e.clientX > 0 &&
|
e.clientY - top > m_chartSize.DiagramTop &&
|
m_chartSize.DiagramBottom + top - e.clientY > 0) {
|
//当前鼠标位置 x的像素
|
var xPixel = parseFloat(e.clientX - left);
|
//
|
drawQueryDataInfoByPixel(xPixel, 1);
|
//修改位置
|
var pathValue1 = [];
|
pathValue1.push("M ", xPixel, " ", m_chartSize.UpDiagram.Up, " L ", xPixel, " ", m_chartSize.DownDiagram.Bottom);
|
objIndicatorLine1.setAttribute('d', pathValue1.join(''));
|
e.preventDefault();
|
}
|
}
|
|
// if (isMoveVerticalLine2 == true) {
|
// if (objIndicatorLine2 == null)
|
// return;
|
// var svg_root = m_svg.getRootNode();
|
// const box = svg_root.getBoundingClientRect();
|
// var top = box.top + window.scrollY - document.documentElement.clientTop;
|
// var left = box.left + window.scrollX - document.documentElement.clientLeft
|
// var e = window.event || e;
|
// if (e.clientX - left > m_chartSize.DiagramLeft &&
|
// m_chartSize.DiagramRight + left - e.clientX > 0 &&
|
// e.clientY - top > m_chartSize.DiagramTop &&
|
// m_chartSize.DiagramBottom + top - e.clientY > 0) {
|
// //当前鼠标位置 x的像素
|
// var xPixel = parseFloat(e.clientX - left);
|
// //
|
// // drawQueryDataInfoByPixel(xPixel, 2);
|
// // //修改位置
|
// // var pathValue1 = new Array();
|
// // pathValue1.push("M ", xPixel, " ", m_chartSize.UpDiagram.Up, " L ", xPixel, " ", m_chartSize.DownDiagram.Bottom);
|
// // objIndicatorLine2.setAttribute('d', pathValue1.join(''));
|
// }
|
// }
|
};
|
obj_divChart.onmouseup = function (e) {
|
if (isMoveVerticalLine1) {
|
isMoveVerticalLine1 = false;
|
e.preventDefault();
|
}
|
// if (isMoveVerticalLine2) {
|
// isMoveVerticalLine2 = false;
|
// }
|
};
|
|
|
//设置显示
|
setQueryIndicatVertLineVisible(m_dispVerticalLine1, 1);
|
};
|
|
//绘制/显示 参数查询信息
|
var drawQueryDataInfoByPixel = function (xPixel, index) {
|
//x的像素
|
if (xPixel == null) return;
|
if (m_connectCurveList == null || m_connectCurveList.length == 0)
|
return;
|
var finish_curve = m_connectCurveList[m_connectCurveList.length-1];
|
|
|
|
if (finish_curve == null) return;
|
if (finish_curve.PixelQH == null) return;
|
//流量
|
let flow_stdUnit = getActualValueQ(xPixel);
|
if (flow_stdUnit == null) return;
|
|
if (flow_stdUnit < 0.1) return;
|
|
|
|
var flow_info = {};
|
flow_info.text = getTranslateString("流量");
|
flow_info.value = UnitHelper.getDispValueQ(
|
UnitHelper.ConvertQ_fromM3H(m_unit.Q, flow_stdUnit)
|
);
|
flow_info.unit = UnitHelper.GetUnitNameQ(m_unit.Q);
|
if (flow_info.value == null || flow_info.value == "") return;
|
|
|
//扬程
|
var head_pixel_pt = getBezierPointY(finish_curve.PixelQH, xPixel);
|
|
if (head_pixel_pt == null) return;
|
var head_stdUnit = getActualValueH(head_pixel_pt.Y);
|
var head_info = {};
|
head_info.text = getTranslateString("扬程");
|
head_info.unit = UnitHelper.GetUnitNameH(m_unit.H);
|
head_info.value = UnitHelper.getDispValueH(
|
UnitHelper.ConvertH_fromM(m_unit.H, head_stdUnit)
|
);
|
|
//效率
|
// var eff_info = {};
|
// eff_info.value = "";
|
// if (m_isDispCurveQE) {
|
// var eta_pixel_pt = getBezierPointY(finish_curve.PixelQE, xPixel);
|
|
// if (eta_pixel_pt != null) {
|
// var eta_stdUnit = getActualValueE(eta_pixel_pt.Y);
|
|
// eff_info.text = getTranslateString("效率");
|
// eff_info.value = parseFloat(eta_stdUnit.toFixed(1));
|
// eff_info.unit = "%";
|
// }
|
// }
|
|
//功率
|
var power_info = {};
|
power_info.value = "";
|
var power_pixel_pt = getBezierPointY(finish_curve.PixelQP, xPixel);
|
if (power_pixel_pt != null) {
|
var power_stdUnit = getActualValueP(power_pixel_pt.Y);
|
power_info.text = getTranslateString("功率");
|
power_info.value = UnitHelper.getDispValueP(
|
UnitHelper.ConvertP_fromKW(m_unit.P, power_stdUnit)
|
);
|
power_info.unit = UnitHelper.GetUnitNameP(m_unit.P);
|
}
|
|
var npsh_info = {}; //汽蚀
|
npsh_info.text = getTranslateString("汽蚀");
|
npsh_info.value = "";
|
npsh_info.unit = "m";
|
|
if (finish_curve.PixelNPSH != null && m_isHaveNpsh) {
|
var npsh_pixel_pt = getBezierPointY(finish_curve.PixelNPSH, xPixel);
|
|
if (npsh_pixel_pt != null) {
|
var npsh_stdUnit = getActualValueNPSH(npsh_pixel_pt.Y);
|
npsh_info.value = UnitHelper.formatToFixed(parseFloat(npsh_stdUnit), 1);
|
}
|
}
|
|
var tip_html = "";
|
var flow_html =
|
flow_info.text +
|
": " +
|
flow_info.value +
|
" " +
|
flow_info.unit;
|
tip_html = flow_html;
|
|
|
var head_html =
|
head_info.text +
|
": " +
|
head_info.value +
|
" " +
|
head_info.unit;
|
tip_html += "</br>" + head_html;
|
|
|
// if (eff_info.value != "") {
|
// var eff_html =
|
// eff_info.text +
|
// ": " +
|
// eff_info.value +
|
// " " +
|
// eff_info.unit;
|
// tip_html += "</br>" + eff_html;
|
// }
|
|
if (power_info.value != "") {
|
var power_html =
|
power_info.text +
|
": " +
|
power_info.value +
|
" " +
|
power_info.unit;
|
tip_html += "</br>" + power_html;
|
}
|
|
// if (npsh_info.value != "") {
|
// var npsh_html =
|
// npsh_info.text +
|
// ": " +
|
// npsh_info.value +
|
// " " +
|
// npsh_info.unit;
|
// tip_html += "</br>" + npsh_html;
|
// }
|
var objInfo = document.getElementById("infoDv4VerticalLineConn1");
|
if (objInfo != null) {
|
objInfo.innerHTML = tip_html;
|
objInfo.style.display = "";
|
}
|
|
|
//获取查询曲线查询得到的数据 给参数查询使用
|
if (onChangeQueryDataCb != null) {
|
onChangeQueryDataCb({
|
Q: flow_info,
|
H: head_info,
|
E: eff_info,
|
P: power_info,
|
NPSH: npsh_info,
|
});
|
}
|
};
|
//设置查询线 的值
|
var setQueryIndicatValue = function (flow_m3h, index) {
|
m_dispVerticalLine1 = true;
|
var xStartValuePixel = getPixelValueQ(flow_m3h);
|
drawQueryIndicatVertLine(xStartValuePixel, 1);
|
};
|
|
//设置是否显示
|
var setQueryIndicatVertLineVisible = function (disp, index) {
|
m_dispVerticalLine1 = disp;
|
var objInfo = document.getElementById("infoDv4VerticalLineConn1");
|
var objLine = document.getElementById("verticalLineConn1");
|
if (objInfo != null && objLine != null) {
|
if (disp) {
|
objInfo.style.display = '';
|
objLine.style.display = '';
|
}
|
else {
|
objInfo.style.display = 'none';
|
objLine.style.display = 'none';
|
}
|
}
|
};
|
//多泵
|
var drawConnectPumpCurve = function () {
|
var curveWidth = 2;
|
if (m_connectCurveList == null || m_connectCurveList.length == 0) {
|
return;
|
}
|
|
for (var i = 0; i < m_connectCurveList.length; i++) {
|
var con_curve = m_connectCurveList[i];
|
con_curve.color = "#003a6c";
|
|
var pixelPointsQH = createCurveQH(
|
"ConnCurveQH" + i,
|
con_curve.RealQH,
|
curveWidth,
|
con_curve.color
|
);
|
if (pixelPointsQH == null)
|
return;
|
|
var pointsRealQH = con_curve.RealQH;
|
drawCurveTextByQH(
|
"ConnCurveQHText" + i,
|
con_curve,
|
pointsRealQH[pointsRealQH.length - 1]
|
);
|
con_curve.PixelQH = transBezierCurveModel(pixelPointsQH);
|
|
|
|
var pixelPointsQP = createCurveQP(
|
"ConnCurveQP1" + i,
|
con_curve.RealQP,
|
curveWidth,
|
con_curve.color
|
);
|
var pointsRealQP = con_curve.RealQP;
|
drawCurveTextByQP(
|
"ConnCurveQPText1" + i,
|
con_curve,
|
pointsRealQP[pointsRealQP.length - 1]
|
);
|
con_curve.PixelQP = transBezierCurveModel(pixelPointsQP);
|
|
}
|
};
|
//单泵
|
var drawSinglePumpCurve = function () {
|
|
var curveWidth = 2;
|
|
removeElementById("ConnCurveQH1");
|
removeElementById("ConnCurveQP1");
|
removeElementById("ConnCurveQHText1");
|
removeElementById("ConnCurveQPText1");
|
//
|
m_originWorkCurve.num = 1;
|
m_originWorkCurve.capture = "1";
|
m_originWorkCurve.color = "#003a6c";
|
|
var curveMaxPathQH = createCurveQH(
|
"ConnCurveQH1",
|
m_originWorkCurve.RealQH,
|
curveWidth,
|
m_originWorkCurve.color
|
);
|
var pointsQH = m_originWorkCurve.RealQH;
|
drawCurveTextByQH(
|
"ConnCurveQHText1",
|
m_originWorkCurve,
|
pointsQH[pointsQH.length - 1]
|
);
|
|
//var curveMaxPathQE = createCurveQE("MaxCurveQE", m_originWorkCurve.RealQE, curveWidth, m_originWorkCurve.color);
|
var curveMaxPathQP = createCurveQP(
|
"ConnCurveQP1",
|
m_originWorkCurve.RealQP,
|
curveWidth,
|
m_originWorkCurve.color
|
);
|
var pointsQP = m_originWorkCurve.RealQP;
|
drawCurveTextByQP(
|
"ConnCurveQPText1",
|
m_originWorkCurve,
|
pointsQP[pointsQP.length - 1]
|
);
|
};
|
|
//刷新图表
|
var refreshDiagramCurve = function () {
|
|
if (m_originWorkCurve == null || m_originWorkCurve.RealQH == null) return;
|
//console.log(m_originWorkCurve.RealQH)
|
|
//删除老的曲线
|
if (m_connectCurveList != null && m_connectCurveList.length > 0) {
|
for (var i = 0; i < m_connectCurveList.length; i++) {
|
removeElementById("ConnCurveQH" + i);
|
removeElementById("ConnCurveQP" + i);
|
removeElementById("ConnCurveQHText" + i);
|
removeElementById("ConnCurveQPText" + i);
|
}
|
}
|
|
|
if (m_connectNum <= 1) {
|
|
drawSinglePumpCurve();
|
|
removeElementById("infoDv4VerticalLineConn1");
|
var objLine = document.getElementById("verticalLineConn1");
|
if (objLine)
|
objLine.style.display = 'none';
|
}
|
else {
|
|
drawSinglePumpCurve();
|
|
drawConnectPumpCurve();
|
|
drawQueryIndicatVertLine();
|
}
|
|
|
|
};
|
|
//计算坐标
|
var calcCoordinateParas = function () {
|
m_coordinatePara = m_coordinateDict["0"];
|
if (m_connectNum <= 1) {
|
return;
|
}
|
|
var curve_min_head = m_originWorkCurve.RealQH[m_originWorkCurve.RealQH.length - 1].Y;
|
var curve_max_head = m_originWorkCurve.RealQH[0].Y;
|
|
var curve_min_power = m_originWorkCurve.RealQP[0].Y;
|
var curve_max_power = m_originWorkCurve.RealQP[m_originWorkCurve.RealQP.length - 1].Y;
|
|
m_originWorkCurve.RealQP.forEach(pt => {
|
if(curve_max_power<pt.Y)
|
curve_max_power=pt.Y;
|
});
|
|
var curve_max_flow = m_originWorkCurve.RealQH[m_originWorkCurve.RealQH.length - 1].X;
|
for (var i = 0; i < m_connectCurveList.length; i++) {
|
var qh = m_connectCurveList[i].RealQH;
|
var qp = m_connectCurveList[i].RealQP;
|
|
curve_max_flow = Math.max(curve_max_flow, qh[qh.length - 1].X);
|
|
|
curve_min_head = Math.min(curve_min_head, qh[qh.length - 1].Y);
|
curve_max_head = Math.max(curve_max_head, qh[0].Y);
|
|
|
curve_min_power = Math.min(curve_min_power, qp[0].Y);
|
|
qp.forEach(pt => {
|
if(curve_max_power<pt.Y)
|
curve_max_power=pt.Y;
|
});
|
|
//curve_max_power = Math.max(curve_max_power, qp[qp.length - 1].Y);
|
}
|
|
if (curve_min_power < 0.1)
|
curve_min_power = 0;
|
|
var objString_Coordinate = JSON.stringify(
|
m_coordinatePara
|
);
|
var coordinatePara = JSON.parse(objString_Coordinate);
|
|
|
//
|
if (m_connectType == 0) {//并联
|
var spaceQ1 = coordinateHelper.GetOptimalSpace(UnitHelper.ConvertQ_fromM3H(m_unit.Q, curve_max_flow * 1.1 / 8.0));
|
var spaceQ2 = UnitHelper.ConvertQ_toM3H(m_unit.Q, spaceQ1);
|
coordinatePara.SpaceQ = spaceQ2;
|
coordinatePara.GridNumberX = -1;
|
for (var i = 0; i < 100; i++) {
|
var q = coordinatePara.DispMinQ + spaceQ2 * i;
|
coordinatePara.GridNumberX++;
|
if (q > curve_max_flow * 1.05) {
|
break;
|
}
|
}
|
}
|
coordinatePara.DispMaxQ = coordinatePara.DispMinQ + (coordinatePara.GridNumberX ) * coordinatePara.SpaceQ ;
|
|
//console.log(coordinatePara,m_coordinateDict["0"])
|
//功率
|
var spaceP1 = coordinateHelper.GetOptimalSpace(UnitHelper.ConvertP_fromKW(m_unit.P, curve_max_power * 1.1 / 5.0));
|
var spaceP2 = UnitHelper.ConvertP_toKW(m_unit.P, spaceP1);
|
coordinatePara.SpaceP = spaceP2;
|
for (var i = 0; i < 100; i++) {
|
var power = coordinatePara.DispMinP + spaceP2 * i;
|
coordinatePara.EndLineNoP = coordinatePara.StartLineNoP + i;
|
coordinatePara.DispMaxP = power;
|
if (power > curve_max_power * 1.1) {
|
break;
|
}
|
}
|
coordinatePara.MinP = coordinatePara.DispMinP - coordinatePara.StartLineNoP * spaceP2;
|
|
//扬程
|
if (m_connectType == 1) {//串联
|
var spaceH1 = coordinateHelper.GetOptimalSpace(UnitHelper.ConvertH_fromM(m_unit.H, curve_max_head * 1.1 / 6.0));
|
var spaceH2 = UnitHelper.ConvertH_toM(m_unit.H, spaceH1);
|
coordinatePara.SpaceH = spaceH2;
|
for (var i = 0; i < 100; i++) {
|
var head = coordinatePara.DispMinH + spaceH2 * i;
|
coordinatePara.EndLineNoH = coordinatePara.StartLineNoH + i;
|
coordinatePara.DispMaxH = head;
|
if (head > curve_max_head * 1.1) {
|
break;
|
}
|
}
|
coordinatePara.MinH = coordinatePara.DispMinH - coordinatePara.StartLineNoH * spaceH2;
|
}
|
|
//console.log(m_coordinatePara);
|
//console.log(coordinatePara);
|
m_coordinatePara = coordinatePara;
|
};
|
//绘制面板(整体)
|
var createGridLineDiagram_Whole = function () {
|
if (m_coordinatePara == null) {
|
return;
|
}
|
|
var attr = {
|
stroke: m_displayStyle.ColorGridLine,
|
"stroke-width": "1",
|
fill: "none",
|
zIndex: 10,
|
};
|
|
//产生网格线竖直方向
|
for (var i = 0; i <= m_coordinatePara.GridNumberX; i++) {
|
var distance = m_chartSize.SpaceGridX * i;
|
var valueTemp = [];
|
valueTemp.push(
|
"M ",
|
m_chartSize.DiagramLeft + distance,
|
" ",
|
m_chartSize.SpaceTop,
|
" L ",
|
m_chartSize.DiagramLeft + distance,
|
" ",
|
m_chartSize.UpDiagram.Bottom
|
);
|
m_svg.createPath(null, valueTemp.join(""), attr, null);
|
}
|
|
//产生网格线水平方向
|
for (var i = 0; i <= m_coordinatePara.GridNumberY; i++) {
|
var distance = m_chartSize.UpDiagram.SpaceGridY * i;
|
var valueTemp = [];
|
valueTemp.push(
|
"M ",
|
m_chartSize.DiagramLeft,
|
" ",
|
m_chartSize.SpaceTop + distance,
|
" L ",
|
m_chartSize.DiagramRight,
|
" ",
|
m_chartSize.SpaceTop + distance
|
);
|
m_svg.createPath(null, valueTemp.join(""), attr, null);
|
}
|
};
|
//绘制面板(分离)
|
var createGridLineDiagram_TwoPanel = function () {
|
if (m_coordinatePara == null) {
|
return;
|
}
|
|
var attr = {
|
stroke: m_displayStyle.ColorGridLine,
|
"stroke-width": "1",
|
fill: "none",
|
zIndex: 10,
|
};
|
|
//产生网格线竖直方向
|
for (var i = 0; i <= m_coordinatePara.GridNumberX; i++) {
|
var distance = m_chartSize.SpaceGridX * i;
|
var valueTemp = [];
|
valueTemp.push(
|
"M ",
|
m_chartSize.DiagramLeft + distance,
|
" ",
|
m_chartSize.UpDiagram.Up,
|
" L ",
|
m_chartSize.DiagramLeft + distance,
|
" ",
|
m_chartSize.UpDiagram.Bottom
|
);
|
m_svg.createPath(null, valueTemp.join(""), attr, null);
|
|
//console.log(m_chartSize.DiagramLeft + distance , m_chartSize.UpDiagram.Up, m_chartSize.DiagramLeft + distance, m_chartSize.UpDiagram.Bottom)
|
}
|
|
for (var i = 0; i <= m_coordinatePara.GridNumberX; i++) {
|
var distance = m_chartSize.SpaceGridX * i;
|
var valueTemp = [];
|
valueTemp.push(
|
"M ",
|
m_chartSize.DiagramLeft + distance,
|
" ",
|
m_chartSize.DownDiagram.Up,
|
" L ",
|
m_chartSize.DiagramLeft + distance,
|
" ",
|
m_chartSize.DownDiagram.Bottom
|
);
|
m_svg.createPath(null, valueTemp.join(""), attr, null);
|
}
|
|
//产生网格线水平方向
|
for (var i = 0; i <= m_chartSize.UpDiagram.GridNumberY; i++) {
|
var distance = m_chartSize.UpDiagram.SpaceGridY * i;
|
var valueTemp = [];
|
valueTemp.push(
|
"M ",
|
m_chartSize.DiagramLeft,
|
" ",
|
m_chartSize.UpDiagram.Up + distance,
|
" L ",
|
m_chartSize.DiagramRight,
|
" ",
|
m_chartSize.UpDiagram.Up + distance
|
);
|
m_svg.createPath(null, valueTemp.join(""), attr, null);
|
}
|
|
for (var i = 0; i <= m_chartSize.DownDiagram.GridNumberY; i++) {
|
var distance = m_chartSize.DownDiagram.SpaceGridY * i;
|
var valueTemp = [];
|
valueTemp.push(
|
"M ",
|
m_chartSize.DiagramLeft,
|
" ",
|
m_chartSize.DownDiagram.Up + distance,
|
" L ",
|
m_chartSize.DiagramRight,
|
" ",
|
m_chartSize.DownDiagram.Up + distance
|
);
|
m_svg.createPath(null, valueTemp.join(""), attr, null);
|
}
|
};
|
//转成Bezier曲线模型
|
var transBezierCurveModel = function (pixelPoints) {
|
if (pixelPoints == null || pixelPoints.length < 4) return null;
|
|
var iPointCout = pixelPoints.length;
|
var a = 0.09;
|
var b = 0.09;
|
var controlPoint = [];
|
|
for (var i = 0; i < iPointCout - 1; i++) {
|
var bezier = {};
|
bezier.Point0 = pixelPoints[i];
|
if (i == 0) {
|
var x1 =
|
pixelPoints[i].X + a * (pixelPoints[i + 1].X - pixelPoints[i].X);
|
var y1 =
|
pixelPoints[i].Y + a * (pixelPoints[i + 1].Y - pixelPoints[i].Y);
|
bezier.Point1 = {
|
X: x1,
|
Y: y1,
|
};
|
} else {
|
var x1 =
|
pixelPoints[i].X + a * (pixelPoints[i + 1].X - pixelPoints[i - 1].X);
|
var y1 =
|
pixelPoints[i].Y + a * (pixelPoints[i + 1].Y - pixelPoints[i - 1].Y);
|
bezier.Point1 = {
|
X: x1,
|
Y: y1,
|
};
|
}
|
|
if (i == iPointCout - 2) {
|
var x2 =
|
pixelPoints[i + 1].X - b * (pixelPoints[i + 1].X - pixelPoints[i].X);
|
var y2 =
|
pixelPoints[i + 1].Y - b * (pixelPoints[i + 1].Y - pixelPoints[i].Y);
|
bezier.Point2 = {
|
X: x2,
|
Y: y2,
|
};
|
} else {
|
var x2 =
|
pixelPoints[i + 1].X - b * (pixelPoints[i + 2].X - pixelPoints[i].X);
|
var y2 =
|
pixelPoints[i + 1].Y - b * (pixelPoints[i + 2].Y - pixelPoints[i].Y);
|
bezier.Point2 = {
|
X: x2,
|
Y: y2,
|
};
|
}
|
|
bezier.Point3 = pixelPoints[i + 1];
|
controlPoint.push(bezier);
|
}
|
return controlPoint;
|
};
|
|
//转成曲线路径
|
var transBezierCurveToPath = function (pixelPoints) {
|
var bezierCurveValue = transBezierCurveModel(pixelPoints);
|
if (bezierCurveValue == null) {
|
return;
|
}
|
var pathValue = [];
|
for (var i = 0; i < bezierCurveValue.length; i++) {
|
var b_pt = bezierCurveValue[i];
|
if (i == 0) {
|
pathValue.push("M ", b_pt.Point0.X, " ", b_pt.Point0.Y);
|
pathValue.push(
|
" C ",
|
b_pt.Point1.X,
|
" ",
|
b_pt.Point1.Y,
|
" ",
|
b_pt.Point2.X,
|
" ",
|
b_pt.Point2.Y,
|
" ",
|
b_pt.Point3.X,
|
" ",
|
b_pt.Point3.Y
|
);
|
} else {
|
pathValue.push(" L ", b_pt.Point0.X, " ", b_pt.Point0.Y);
|
pathValue.push(
|
" C ",
|
b_pt.Point1.X,
|
" ",
|
b_pt.Point1.Y,
|
" ",
|
b_pt.Point2.X,
|
" ",
|
b_pt.Point2.Y,
|
" ",
|
b_pt.Point3.X,
|
" ",
|
b_pt.Point3.Y
|
);
|
}
|
if (i == bezierCurveValue.length - 1) {
|
pathValue.push(" L ", b_pt.Point3.X, " ", b_pt.Point3.Y);
|
}
|
}
|
return pathValue;
|
};
|
|
//返回标准单位下的值
|
var getActualValueQ = function (pixelValue) {
|
var actualMinValue = m_coordinatePara.DispMinQ;
|
var actualMaxValue = m_coordinatePara.DispMaxQ;
|
var pixelMinValue = m_chartSize.DiagramLeft;
|
var pixelMaxValue = m_chartSize.DiagramRight;
|
return (
|
((pixelValue - pixelMinValue) / (pixelMaxValue - pixelMinValue)) *
|
(actualMaxValue - actualMinValue) +
|
actualMinValue
|
);
|
};
|
var getActualValueH = function (pixelValue) {
|
var actualMinValue = m_coordinatePara.DispMinH;
|
var actualMaxValue = m_coordinatePara.DispMaxH;
|
var pixelMinValue = m_chartSize.PanelH.Bottom;
|
var pixelMaxValue = m_chartSize.PanelH.Up;
|
|
var actualValue =
|
((pixelValue - pixelMinValue) / (pixelMaxValue - pixelMinValue)) *
|
(actualMaxValue - actualMinValue) +
|
actualMinValue;
|
|
return actualValue;
|
};
|
var getActualValueE = function (pixelValue) {
|
var actualMinValue = m_coordinatePara.DispMinE;
|
var actualMaxValue = m_coordinatePara.DispMaxE;
|
var pixelMinValue = m_chartSize.PanelE.Bottom;
|
var pixelMaxValue = m_chartSize.PanelE.Up;
|
|
var actualValue =
|
((pixelValue - pixelMinValue) / (pixelMaxValue - pixelMinValue)) *
|
(actualMaxValue - actualMinValue) +
|
actualMinValue;
|
return actualValue;
|
};
|
var getActualValueP = function (pixelValue) {
|
var actualMinValue = m_coordinatePara.DispMinP;
|
var actualMaxValue = m_coordinatePara.DispMaxP;
|
var pixelMinValue = m_chartSize.PanelP.Bottom;
|
var pixelMaxValue = m_chartSize.PanelP.Up;
|
return (
|
((pixelValue - pixelMinValue) / (pixelMaxValue - pixelMinValue)) *
|
(actualMaxValue - actualMinValue) +
|
actualMinValue
|
);
|
};
|
var getActualValueNPSH = function (pixelValue) {
|
var actualMinValue = m_coordinatePara.DispMinNPSH;
|
var actualMaxValue = m_coordinatePara.DispMaxNPSH;
|
var pixelMinValue = m_chartSize.PanelNPSH.Bottom;
|
var pixelMaxValue = m_chartSize.PanelNPSH.Up;
|
var actualValue =
|
((pixelValue - pixelMinValue) / (pixelMaxValue - pixelMinValue)) *
|
(actualMaxValue - actualMinValue) +
|
actualMinValue;
|
|
return actualValue;
|
};
|
|
// actualValue 是标准单位下的值
|
var getPixelValueQ = function (actualValue) {
|
var actualMinValue = m_coordinatePara.DispMinQ;
|
var actualMaxValue = m_coordinatePara.DispMaxQ;
|
var pixelMinValue = m_chartSize.DiagramLeft;
|
var pixelMaxValue = m_chartSize.DiagramRight;
|
|
return (
|
((actualValue - actualMinValue) / (actualMaxValue - actualMinValue)) *
|
(pixelMaxValue - pixelMinValue) +
|
pixelMinValue
|
);
|
};
|
var getPixelValueH = function (actualValue) {
|
var actualMinValue = m_coordinatePara.DispMinH;
|
var actualMaxValue = m_coordinatePara.DispMaxH;
|
var pixelMinValue = m_chartSize.PanelH.Bottom;
|
var pixelMaxValue = m_chartSize.PanelH.Up;
|
|
if (actualMaxValue == actualMinValue) return actualMinValue;
|
var v =
|
((actualValue - actualMinValue) / (actualMaxValue - actualMinValue)) *
|
(pixelMaxValue - pixelMinValue) +
|
pixelMinValue;
|
|
return v;
|
};
|
var getPixelValueE = function (actualValue) {
|
var actualMinValue = m_coordinatePara.DispMinE;
|
var actualMaxValue = m_coordinatePara.DispMaxE;
|
var pixelMinValue = m_chartSize.PanelE.Bottom;
|
var pixelMaxValue = m_chartSize.PanelE.Up;
|
if (actualMaxValue == actualMinValue) return actualMinValue;
|
|
return (
|
((actualValue - actualMinValue) / (actualMaxValue - actualMinValue)) *
|
(pixelMaxValue - pixelMinValue) +
|
pixelMinValue
|
);
|
};
|
var getPixelValueP = function (actualValue) {
|
var actualMinValue = m_coordinatePara.DispMinP;
|
var actualMaxValue = m_coordinatePara.DispMaxP;
|
var pixelMinValue = m_chartSize.PanelP.Bottom;
|
var pixelMaxValue = m_chartSize.PanelP.Up;
|
if (actualMaxValue == actualMinValue) return actualMinValue;
|
|
return (
|
((actualValue - actualMinValue) / (actualMaxValue - actualMinValue)) *
|
(pixelMaxValue - pixelMinValue) +
|
pixelMinValue
|
);
|
};
|
var getPixelValueNPSH = function (actualValue) {
|
var actualMinValue = m_coordinatePara.DispMinNPSH;
|
var actualMaxValue = m_coordinatePara.DispMaxNPSH;
|
var pixelMinValue = m_chartSize.PanelNPSH.Bottom;
|
var pixelMaxValue = m_chartSize.PanelNPSH.Up;
|
if (actualMaxValue == actualMinValue) return actualMinValue;
|
|
return (
|
((actualValue - actualMinValue) / (actualMaxValue - actualMinValue)) *
|
(pixelMaxValue - pixelMinValue) +
|
pixelMinValue
|
);
|
};
|
|
/** ----------------对外函数-------------------- **/
|
|
//设置设计点公差
|
this.SetUnit = function (unitQ, unitH, unitP, unitNPSH) {
|
m_unit.Q = unitQ;
|
m_unit.H = unitH;
|
m_unit.P = unitP;
|
if (unitNPSH > 0) {
|
m_unit.NPSH = unitNPSH;
|
} else {
|
m_unit.NPSH = 0;
|
}
|
};
|
|
//设置是否是单色显示
|
this.setMonorColor = function (isMonorColor) {
|
document.getElementById(m_divChartName).innerHTML = "";
|
setObjectColor(isMonorColor);
|
if (!initialSvg()) return;
|
|
drawDiagramPanel();
|
|
refreshDiagramCurve();
|
};
|
//设置是否是单色显示
|
this.setWrkCurveInfo = function (dp, curve) {
|
if (curve == null) return;
|
if (m_originWorkCurve == null) m_originWorkCurve = {};
|
m_originWorkCurve.RealQH = curve.RealQH;
|
m_originWorkCurve.RealQE = curve.RealQE;
|
m_originWorkCurve.RealQP = curve.RealQP;
|
m_originWorkCurve.RealNPSH = curve.RealNPSH;
|
|
if (curve.RealNPSH == null) {
|
m_isHaveNpsh = false;
|
} else {
|
m_isHaveNpsh = true;
|
}
|
};
|
|
|
|
|
//设置容器
|
this.setContainerDiv = function (divChartName, divWidth, divHeight) {
|
m_divChartName = divChartName;
|
|
if (m_chartSize == null) {
|
m_chartSize = {};
|
}
|
|
if (divWidth != null) {
|
m_chartSize.TotalWidth = divWidth;
|
} else {
|
m_chartSize.TotalWidth =
|
document.getElementById(divChartName).clientWidth;
|
}
|
|
if (divHeight != null) {
|
m_chartSize.TotalHeight = divHeight;
|
} else {
|
m_chartSize.TotalHeight =
|
document.getElementById(divChartName).clientHeight;
|
}
|
|
};
|
//设置语言
|
this.setLocalizationType = function (localizationType) {
|
m_localizationType = localizationType;
|
};
|
//设置工具提示栏
|
this.setToolTipName = function (toolTipName) { };
|
//获取查询曲线查询得到的数据 给参数查询使用
|
this.setChangeQueryDataCb = function (cb) {
|
onChangeQueryDataCb = cb;
|
};
|
this.setQueryIndicatVertLineVisible = function (isVisible, index) {
|
setQueryIndicatVertLineVisible(isVisible, index);
|
};
|
this.getQueryIndicatVertLineVisible = function () {
|
return m_dispVerticalLine1;
|
};
|
//
|
this.getOriginWorkCurveQP = function () {
|
return m_originWorkCurve.RealQP;
|
};
|
this.getOriginWorkCurveQH = function () {
|
return m_originWorkCurve.RealQH;
|
};
|
this.setSingleCurveStatus = function () {
|
m_connectType = 0;
|
m_connectNum = 1;
|
};
|
//修改并联曲线状态
|
this.setConnectCurveStatus = function (type, num, curvesQH, curvesQP) {
|
m_connectType = type;//0 并联 1串联
|
m_connectNum = num;
|
|
|
if (curvesQH == null)
|
return;
|
|
document.getElementById(m_divChartName).innerHTML = "";
|
|
m_connectCurveList = [];
|
for (var i = 0; i < curvesQH.length; i++) {
|
var con_curve = {};
|
con_curve.num = 2 + i;
|
con_curve.capture = con_curve.num.toString();
|
|
con_curve.RealQH = curvesQH[i];
|
con_curve.RealQP = curvesQP[i];
|
|
m_connectCurveList.push(con_curve);
|
}
|
|
calcCoordinateParas();
|
|
|
//初始化面板
|
initialPanelSize();
|
|
//绘制水印
|
drawLogoWaterMark();
|
|
drawDiagramPanel();
|
|
refreshDiagramCurve();
|
};
|
//初始化图表(入口)
|
this.initialChart = function (ChartFullInfo, displayStyle) {
|
if (!m_divChartName) return;
|
//清空
|
document.getElementById(m_divChartName).innerHTML = "";
|
|
if (ChartFullInfo.ChartObjectDict == null) return;
|
if (ChartFullInfo.ChartObjectDict.Coordinate == null) return;
|
|
m_designPointTolerance = PointToleranceConfig.GetDefaultTolerancePara();
|
|
//
|
m_pumpInfo = ChartFullInfo.BaseInfo;
|
|
m_originWorkCurve = {};
|
m_originWorkCurve.speed = m_pumpInfo.Ratedn;
|
m_originWorkCurve.hz = m_pumpInfo.MotorFrequece;
|
if (m_originWorkCurve.hz == null || m_originWorkCurve.hz < 10)
|
m_originWorkCurve.hz = 50;
|
|
|
m_chartSetting = ChartFullInfo.SettingInfo;
|
m_chartObject = ChartFullInfo.ChartObjectDict;
|
|
//克隆一下,坐标和性能曲线的不一定一致,会修改
|
var objString_Coordinate = JSON.stringify(
|
ChartFullInfo.ChartObjectDict.Coordinate
|
);
|
m_coordinatePara = JSON.parse(objString_Coordinate);
|
m_coordinateDict = {};
|
m_coordinateDict["0"] = m_coordinatePara;
|
|
|
|
this.SetUnit(
|
//设置单位
|
m_chartSetting.SeriesUnitQ,
|
m_chartSetting.SeriesUnitH,
|
m_chartSetting.SeriesUnitP,
|
m_chartSetting.SeriesUnitNPSH
|
);
|
|
// //初始化速度列表
|
// var speedList = [];
|
// if (
|
// ChartFullInfo.MultiSpeedInfo != null &&
|
// ChartFullInfo.MultiSpeedInfo.SpeedItems != null
|
// ) {
|
// speedList = ChartFullInfo.MultiSpeedInfo.SpeedItems;
|
|
|
// } else {
|
// speedList.push({ Value: m_originWorkCurve.speed * 0.9, Type: 0 });
|
// speedList.push({ Value: m_originWorkCurve.speed * 0.8, Type: 0 });
|
// speedList.push({ Value: m_originWorkCurve.speed * 0.7, Type: 0 });
|
// speedList.push({ Value: m_originWorkCurve.speed * 0.6, Type: 0 });
|
// }
|
|
|
|
//初始化显示设置
|
initialDispStyle(displayStyle, m_chartSetting);
|
|
m_chartDiagramPanelStyle = ConstParas.ChartDiagramPanelStyle.Two;
|
|
//初始化面板尺寸
|
initialPanelSize();
|
//绘制水印
|
drawLogoWaterMark();
|
//
|
drawDiagramPanel();
|
|
return this;
|
};
|
|
//根据流量计算功率
|
this.calcPowerByFlow = function (flow, unit) {
|
if (
|
flow == null ||
|
m_originWorkCurve == null ||
|
m_originWorkCurve.PixelQP == null
|
)
|
return null;
|
var flow_stdUnit = UnitHelper.ConvertQ_toM3H(unit, flow);
|
if (flow_stdUnit < 0.1) return null;
|
|
var xPixel = getPixelValueQ(flow_stdUnit);
|
var power_pixel_pt = getBezierPointY(m_originWorkCurve.PixelQP, xPixel);
|
if (power_pixel_pt != null) {
|
var power = getActualValueP(power_pixel_pt.Y);
|
|
return power.toFixed(2);
|
} else {
|
return null;
|
}
|
};
|
//根据流量计算效率
|
this.calcEtaByFlow = function (flow, unit) {
|
if (
|
flow == null ||
|
m_originWorkCurve == null ||
|
m_originWorkCurve.PixelQE == null
|
)
|
return null;
|
var flow_stdUnit = UnitHelper.ConvertQ_toM3H(unit, flow);
|
if (flow_stdUnit < 0.1) return null;
|
|
var xPixel = getPixelValueQ(flow_stdUnit);
|
var power_pixel_pt = getBezierPointY(m_originWorkCurve.PixelQE, xPixel);
|
if (power_pixel_pt != null) {
|
var power = getActualValueE(power_pixel_pt.Y);
|
return power.toFixed(2);
|
} else {
|
return null;
|
}
|
};
|
//转化成m3h流量
|
this.transFlowToM3H = function (flow) {
|
return UnitHelper.ConvertQ_fromM3H(m_unit.Q, flow);
|
};
|
//设置查询值
|
this.setQueryIndicatValue = function (value, index) {
|
setQueryIndicatValue(value, index);
|
};
|
//重绘图表大小
|
this.Resize = function (widht, height) {
|
if (widht && widht > 0) m_chartSize.TotalWidth = widht;
|
if (height && height > 0) m_chartSize.TotalHeight = height;
|
|
document.getElementById(m_divChartName).innerHTML = "";
|
|
//初始化面板
|
initialPanelSize();
|
//绘制水印
|
drawLogoWaterMark();
|
|
drawDiagramPanel();
|
|
refreshDiagramCurve();
|
};
|
};
|
|
export default ConnChartDiagram;
|