private void HighChartsJs(StringBuilder jscode) { jscode.Append("$(function(){$('#" + Id + "').highcharts({ "); jscode.Append("credits: { enabled: false },"); jscode.Append("chart:{ type: '" + Type.ToString().ToLower() + "'"); if (Width > 0) { jscode.Append(",width:" + Width); } if (Height > 0) { jscode.Append(",height:" + Height); } jscode.Append("},"); if (!string.IsNullOrEmpty(Title)) { jscode.Append("title: { text: '" + Title + "'},"); } if (!string.IsNullOrEmpty(SubTitle)) { jscode.Append("subtitle: { text: '" + SubTitle + "'},"); } //判断类型及数据显示 if (XAxis != null && Type != ChartType.Pie) { XAxisToString(jscode, XAxis); } else if (Series.SeriesData != null && Type != ChartType.Pie) { XAxisToString(jscode, Series.SeriesData.Keys.ToList()); } else if (SeriesList != null && SeriesList.Count > 0) { XAxisToString(jscode, SeriesList[0].SeriesData.Keys.ToList()); } if (!string.IsNullOrEmpty(YAxis)) { if (YAxis.IndexOf("title") < 0) { jscode.Append("yAxis: { title:{ text:'" + YAxis + "'}},"); if (string.IsNullOrEmpty(Tooltip)) { jscode.Append("tooltip: { valueSuffix:'" + YAxis + "' },"); } } else { jscode.Append("yAxis: {" + YAxis + "},"); } } jscode.Append("legend: { enabled: " + Legend.ToString().ToLower() + " },"); if (!string.IsNullOrEmpty(Tooltip)) { jscode.Append("tooltip: {" + Tooltip + "},"); } if (!string.IsNullOrEmpty(PlotOptions)) { jscode.Append("plotOptions:{" + PlotOptions + "},"); } //数据处理方法 SeriesToString(jscode); jscode.Append(" }); });"); }