if (pie == "最大值" || pie == "最小值" || pie == "均值" || pie == "标准差" || pie == "方差" || pie == "包络范围" || pie == "正态分布") {
var max = option1.series[0].data[0];
var min = option1.series[0].data[0];
var avage;
var len = option1.series[0].data.length;
var swait = 0;
var sumtwo=0;
for (var j = 0; j < len; j++) {
swait += option1.series[0].data[j];
if (max < option1.series[0].data[j]) {
max = option1.series[0].data[j];
}
if (min> option1.series[0].data[j]) {
min = option1.series[0].data[j];
}
}
avage = swait / len;
for (var k = 0; k < len; k++) {
sumtwo += (option1.series[0].data[k]-avage)*(option1.series[0].data[k]-avage);
}
var sumtwo = sumtwo / len;
var mm = Math.sqrt(sumtwo);
mm = Math.round(mm);
var pp = $('input:checkbox:checked');
for (i = 0; i < pp.length; i++) {
Maxx.push(pp[i].defaultValue);
if (pp[i].defaultValue == "最大值") {
smdata +=
// "[{\"name\":\"最大值\",\"x\":90,\"y\":"+max+"},{\"x\":650,\"y\":"+max+"}],"
"[{\"name\":\"最大值\",\"coord\":[0," + max + "]},{\"coord\":[" + (len - 0.8) + "," + max + "]}],"
}
if (pp[i].defaultValue == "方差") {
smdata +=
"[{\"name\":\"方差\",\"x\":90,\"y\":150},{\"x\":650,\"y\":150}],"
}
if (pp[i].defaultValue == "均值") {
smdata +=
//"[{\"name\":\"均值\",\"x\":90,\"y:" + avage + "},{\"x\":650,\"y:" + avage+"}],"
"[{\"name\":\"均值\",\"coord\":[0," + avage + "]},{\"coord\":[" + (len - 0.8) + "," + avage + "]}],"
}
if (pp[i].defaultValue == "最小值") {
smdata +=
"[{\"name\":\"最小值\",\"coord\":[0,"+min+"]},{\"coord\":["+(len-0.8)+","+min+"]}],"
// smdata += "[{\"name\":\"最小值\",\"x\":90,\"y\":"+min+"},{\"x\":650,\"y\":"+min+"}],"
}
if (pp[i].defaultValue == "标准差") {
smdata +=
//"[{\"name\":\"标准差\",\"x\":90,\"y\":" + mm + "},{\"x\":650,\"y\":" + mm + "}],"
"[{\"name\":\"标准差\",\"coord\":[0," + mm + "]},{\"coord\":[" + (len - 0.8) + "," + mm + "]}],"
}
if (pp[i].defaultValue == "正态分布") {
//smdata+= "[{\"name\":\"\",\"x\":90,\"y\":50},{\"x\":650,\"y\":50}],"
Isradio = true;
}
if (pp[i].defaultValue == "包络范围") {
smdata += "[{\"name\":\"包络范围\",\"x\":90,\"y\":300},{\"x\":650,\"y\":300}],[{\"name\":\"包络范围\",\"x\":90,\"y\":50},{\"x\":650,\"y\":50}],"
}
//alert(pp[i].defaultValue);
}
smdata = '[' + smdata.substring(0, smdata.length - 1) + ']';
var jsondata = JSON.parse(smdata);
smark = {
data:
jsondata
};
//var obj = smdata.parseJSON();
series1 = [
{
name: '加电故障',
type: 'bar',
data: [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 35.6, 62.2, 32.6, 20.0, 6.4, 3.3],
markLine: {
data: [
[
{
name: '方差',
x: 90,
y: 350
},
{
x: 650,
y: 350
}
]
, [
{
name: '平均值',
x: 90,
y: 400
},
{
x: 650,
y: 400
}
]
,
[
{
name: '最小值',
x: 90,
y: 530
},
{
x: 650,
y: 530
}
]
,
[
{
name: '标准差',
x: 90,
y: 450
},
{
x: 650,
y: 450
}
]
]
}
},
{
name: '给水故障',
type: 'bar',
data: [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 75.6, 82.2, 48.7, 18.8, 6.0, 2.3]
},
{
name: '排水故障',
type: 'bar',
data: [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]
}
,
{
name: '下电故障',
type: 'bar',
data: [2.0, 21.2, 31.13, 41.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]
}
,
{
name: '运行故障',
type: 'bar',
data: [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 10.3, 3.4, 23.0, 6.5, 12.0, 6.2]
}
]
//option1.series.markLine=series1;
option1.series[0].markLine = smark;
alert(smdata);
//myChart.clear();
var IsZt = false;
for (var i = 0; i < option1.series.length; i++) {
if (option1.series[i].name == '正态分布') {
IsZt = true;
if (Isradio == false) {
var item1 = [
{
name: '加电故障',
type: 'bar',
data: [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 35.6, 62.2, 32.6, 20.0, 6.4, 3.3],
markLine: {
}
},
{
name: '给水故障',
type: 'bar',
data: [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 75.6, 82.2, 48.7, 18.8, 6.0, 2.3]
},
{
name: '排水故障',
type: 'bar',
data: [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]
}
,
{
name: '下电故障',
type: 'bar',
data: [2.0, 21.2, 31.13, 41.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]
}
,
{
name: '运行故障',
type: 'bar',
data: [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 10.3, 3.4, 23.0, 6.5, 12.0, 6.2]
}
];
myChart.clear();
option1.series = item1;
option1.series[0].markLine = smark;
}
}
}
if (Isradio == true) {
if (IsZt == false) {
var item = {
name: '正态分布',
type: 'line',
data: [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 75.6, 82.2, 48.7, 18.8, 6.0, 2.3],
smooth: true,
symbol: 'none',
};
option1.series.push(item);
}
}
alert(smark);
myChart.setOption(option1);
Isradio = false;
//alert (option1.toolbox.series.markLine);
//option1
}