"); dv.css("height", "100px"); return; } keys = Object.keys(data); var i; var count = keys.length; var cutStr = tab <= 2 ? 5 : 2; var jumps = Math.ceil(count / 10); var vv; var v1 = [], v2 = [], v3 = []; for (i = 0; i < count; i++) { labels.push((i % jumps) == 0 ? keys[i] : ""); vv = data[keys[i]]; values.push(vv); v1.push(vv[0]); v2.push(vv[1]); v3.push(vv[2]); } icData = [ { name: "单位净值", value: v1, color: colors[0], }, { name: "累计净值", value: v2, color: colors[1], }, { name: "复权净值", value: v3, color: colors[2], } ]; $("#dvLegend > span").each(function (index, item) { $(item).css("color", colors[index]); }); $("#dvLegend").show(); DrawChart(); }); function LegendClicked(oa) { $(oa).next("label").toggleClass("nosel"); DrawChart(); } function DrawChart() { var dv = $("#dvChart"); if ($("#dvLegend input:checked").length == 0) { dv.html(""); return; } var mins = [], maxs = []; mydata = []; var ix; $("#dvLegend input:checked").each(function (index, item) { ix = $val.ToInt($(item).val()); mins.push(Math.min.apply(null, icData[ix].value)); maxs.push(Math.max.apply(null, icData[ix].value)); mydata.push(icData[ix]); }); var min = Math.min.apply(null, mins) var max = Math.max.apply(null, maxs) if (max >= 10) { min = Math.floor(min); max = Math.ceil(max); } else { if (max >= 2) { min = Math.floor(min * 10) / 10; max = Math.ceil(max * 10) / 10; } else { min = Math.floor(min * 100) / 100; max = Math.ceil(max * 100) / 100; } } new iChart.LineBasic2D({ render: 'dvChart', data: mydata, border: { enable: false, }, width: chartWidth, height: chartHeight, tip: { enable: true, shadow: true, showType: "fixed", listeners: { parseText: function (tip, name, value, text, index) { var msg = keys[index]; var i; for (i = 0; i < mydata.length; i++) { msg += "
" + mydata[i].name + ":" + mydata[i].value[index]; } return msg; } } }, legend: { enable: false, }, crosshair: { enable: true, line_color: '#62bce9' }, sub_option: { label: false, hollow_inside: false, point_size: 0, }, coordinate: { axis: { enable: true, width: [0, 0, 1, 1], }, grids: { vertical: { way: 'share_alike', value: 1 } }, scale: [{ position: 'left', start_scale: min, end_scale: max, scale_space: 50, label: { fontsize: 12 }, scale_color: '#9f9f9f' }, { position: 'bottom', scale_enable: false, label: { fontsize: 9 }, labels: labels, }] }, }).draw(); setTimeout(function () { dv.children("div").children("div:gt(1)").hide(); }, 500); }
{"InnerBanner":null,"MbPageUrl":null,"PageTitle":null,"Redirect":null,"Data":null,"UserInfo":{"ID":0,"UName":null,"Face":null}}