本文整理汇总了C#中Data.GetLength方法的典型用法代码示例。如果您正苦于以下问题:C# Data.GetLength方法的具体用法?C# Data.GetLength怎么用?C# Data.GetLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data
的用法示例。
在下文中一共展示了Data.GetLength方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateGraphBody
public string GenerateGraphBody(string id, Data[] data, string[] tick_label)
{
string ret = "";
ret += "<div id=\"" + id + "\"></div>\n";
ret += "<script>\n";
ret += "(function basic_radar(container) {\n";
for (int x = 0; x < data.GetLength(0); x++)
{
ret += "var s" + x + " = { label : '" + data[x].label + "', data : [";
for (int y = 0; y < data[x].data.GetLength(0); y++)
{
if (y != 0)
{
ret += ",";
}
ret += "[" + y + "," + data[x].data[y] + "]";
}
ret += "]};";
}
ret += "var ticks = [\n";
for (int i = 0; i < tick_label.Length; i++)
{
if (i != 0)
{
ret += ",";
}
ret += "[" + i + ", \"" + tick_label[i] + "\"]\n";
}
ret += "]\n";
ret += "graph = Flotr.draw(container,[";
for (int x = 0; x < data.GetLength(0); x++)
{
if (x != 0)
{
ret += ",";
}
ret += "s" + x;
}
ret += "], {\n";
ret += "radar : { show : true}, \n";
ret += "grid : { circular : true, minorHorizontalLines : true}, \n";
ret += "yaxis : { min : " + m_min + ", max : " + m_max + ", minorTickFreq : 2}, \n";
ret += "xaxis : { ticks : ticks},\n";
ret += "mouse : { track : true}\n";
ret += "});\n";
ret += "})(document.getElementById(\"" + id + "\"));\n";
ret += "</script>\n";
return ret;
}
示例2: GenerateGraphBody
public string GenerateGraphBody(string id, Data[] data)
{
string ret = "";
ret += "<div id=\"" + id + "\"></div>\n";
ret += "<script>\n";
ret += "(function basic_pie(container) {\n";
for (int x = 0; x < data.GetLength(0); x++)
{
ret += "var d" + x + " = [";
ret += "[" + '0' + "," + data[x].value + "]";
ret += "];";
}
ret += "graph = Flotr.draw(container,[\n";
for (int x = 0; x < data.GetLength(0); x++)
{
ret += "{ data : d" + x + ", label : '" + data[x].label + "', ";
ret += "pie : { explode : " + data[x].explode + "}";
ret += "},\n";
}
ret += "], {\n";
ret += "HtmlText : false,\n";
ret += "grid : {\n";
ret += "verticalLines : false,\n";
ret += "horizontalLines : false\n";
ret += "},\n";
ret += "xaxis : { showLabels : false },\n";
ret += "yaxis : { showLabels : false },\n";
ret += "pie : {\n";
ret += "show : true, \n";
ret += "},\n";
ret += "mouse : { track : true },\n";
ret += "legend : {\n";
ret += "position : 'se',\n";
ret += "backgroundColor : '#D2E8FF'\n";
ret += "}\n";
ret += "});\n";
ret += "})(document.getElementById(\"" + id + "\"));\n";
ret += "</script>\n";
return ret;
}
示例3: GenerateGraphBody
public string GenerateGraphBody(string id, Data[] data, string xtitle, string ytitle)
{
string ret = "";
ret += "<div id=\"" + id + "\"></div>\n";
ret += "<script>\n";
ret += "(function basic_bubble(container) {\n";
float xmax = data[0].point[0].x;
float xmin = data[0].point[0].x;
float ymax = data[0].point[0].y;
float ymin = data[0].point[0].y;
float base_r = 5.0f;
for (int x = 0; x < data.GetLength(0); x++)
{
ret += "var d" + x + " = [\n";
for (int y = 0; y < data[x].point.Count(); y++)
{
if (y != 0)
{
ret += ",\n";
}
ret += "\t[" + data[x].point[y].x + "," + data[x].point[y].y + "," + data[x].point[y].r + "]";
if (xmin > data[x].point[y].x - data[x].point[y].r - base_r)
{
xmin = data[x].point[y].x - data[x].point[y].r - base_r;
}
if (xmax < data[x].point[y].x + data[x].point[y].r + base_r)
{
xmax = data[x].point[y].x + data[x].point[y].r + base_r;
}
if (ymin > data[x].point[y].y - data[x].point[y].r - base_r)
{
ymin = data[x].point[y].y - data[x].point[y].r - base_r;
}
if (ymax < data[x].point[y].y + data[x].point[y].r + base_r)
{
ymax = data[x].point[y].y + data[x].point[y].r + base_r;
}
}
ret += "\n];\n";
}
ret += "graph = Flotr.draw(container,[\n";
for (int x = 0; x < data.GetLength(0); x++)
{
ret += "{ data : d" + x + ", label : '" + data[x].label + "' ";
ret += "},\n";
}
ret += "], {\n";
ret += "bubbles : { show : true, baseRadius : " + base_r + " },\n";
ret += "xaxis : { min : " + xmin + ", max : " + xmax + " , title: '" + xtitle + "'},\n";
ret += "yaxis : { min : " + ymin + ", max : " + ymax + " , title: '" + ytitle + "'}\n";
ret += "});\n";
ret += "})(document.getElementById(\"" + id + "\"));\n";
ret += "</script>\n";
return ret;
}
示例4: GenerateGraphBody
public override string GenerateGraphBody(string id, Data[] data, string[] xlabel, string xtitle, string ytitle)
{
string ret = "";
string horizontal;
float bar_width = 0.8f / data.GetLength(0);
if (m_horizontal)
{
horizontal = "true";
}
else
{
horizontal = "false";
}
ret += "<div id=\"" + id + "\"></div>\n";
ret += "<script>\n";
ret += "(function basic_bars(container, horizontal) {\n";
for (int x = 0; x < data.GetLength(0); x++)
{
ret += "var d" + x + " = [\n";
for (int y = 0; y < data[x].data.GetLength(0); y++)
{
if (y != 0)
{
ret += ",";
}
if (m_horizontal)
{
ret += "[" + data[x].data[y] + "," + (y + bar_width * x) + "]\n";
}
else
{
ret += "[" + (y + bar_width * x) + "," + data[x].data[y] + "]\n";
}
}
ret += "];\n";
}
ret += "var ticks = [\n";
for (int i = 0; i < xlabel.Count(); i++)
{
if (i != 0)
{
ret += ",";
}
ret += "[" + i + ", '" + xlabel[i] +"']\n";
}
ret += "]; \n";
ret += "graph = Flotr.draw(container,[\n";
for (int x = 0; x < data.GetLength(0); x++)
{
ret += "{ data : d" + x + ", label : '" + data[x].label + "' },\n";
}
ret += "], {\n";
ret += "legend : {\n";
ret += "backgroundColor : '#D2E8FF', \n";
ret += "position : 'se'";
ret += "},\n";
ret += "bars : {\n";
ret += "show : true,\n";
ret += "stacked : false,\n";
ret += "horizontal : horizontal,\n";
ret += "barWidth : " + bar_width + ",\n";
ret += "lineWidth : 1,\n";
ret += "shadowSize : 0\n";
ret += "},\n";
if (m_horizontal)
{
ret += "yaxis : { title: \"" + ytitle + "\", ticks : ticks},\n";
ret += "xaxis : { title: \"" + xtitle + "\", labelsAngle: 30},\n";
}
else
{
ret += "yaxis : { title: \"" + ytitle + "\"},\n";
ret += "xaxis : { title: \"" + xtitle + "\", ticks : ticks, labelsAngle: 30},\n";
}
ret += "mouse : {\n";
ret += "track : true,\n";
ret += "relative : true\n";
ret += "},\n";
ret += "grid : {\n";
ret += "verticalLines : horizontal,\n";
ret += "horizontalLines : !horizontal\n";
ret += "}, \n";
ret += "HtmlText: false \n";
ret += "});\n";
ret += "})(document.getElementById(\"" + id + "\"), " + horizontal + ");\n";
ret += "</script>\n";
//.........这里部分代码省略.........
示例5: GenerateGraphBody
public override string GenerateGraphBody(string id, Data[] data, string[] xlabel, string xtitle, string ytitle)
{
string ret = "";
string horizontal;
float bar_width = 0.8f / data.GetLength(0);
horizontal = "false";
ret += "<div id=\"" + id + "\"></div>\n";
ret += "<script>\n";
ret += "(function basic_bars(container, horizontal) {\n";
// for bar
for (int x = 0; x < data.GetLength(0); x++)
{
ret += "var d" + x + " = [\n";
for (int y = 0; y < data[x].data.GetLength(0); y++)
{
if (y != 0)
{
ret += ",";
}
ret += "[" + (y + bar_width * x) + "," + data[x].data[y] + "]\n";
}
ret += "];\n";
}
// for line
for (int x = 0; x < data.GetLength(0); x++)
{
ret += "var dl" + x + " = [\n";
float sum = 0.0f;
for (int y = 0; y < data[x].data.GetLength(0); y++)
{
sum += data[x].data[y];
}
float sum2 = 0.0f;
ret += "[" + (-1 + bar_width * x) + "," + 0 + "]\n";
for (int y = 0; y < data[x].data.GetLength(0); y++)
{
ret += ",";
sum2 += data[x].data[y];
float rt = sum2 / sum * 100.0f;
ret += "[" + (y + bar_width * x) + "," + rt + "]\n";
}
ret += ", [" + (data[x].data.GetLength(0) + bar_width * x) + "," + 100 + "]\n";
ret += "];\n";
}
// for marker
for (int x = 0; x < data.GetLength(0); x++)
{
ret += "var m" + x + " = [\n";
for (int y = 0; y < data[x].data.GetLength(0); y++)
{
if (y != 0)
{
ret += ",";
}
ret += "[" + (y + bar_width * x) + "," + data[x].data[y] + "]\n";
}
ret += "];\n";
}
// for ticks
ret += "var ticks = [\n";
for (int i = 0; i < xlabel.Count(); i++)
{
if (i != 0)
{
ret += ",";
}
ret += "[" + i + ", '" + xlabel[i] + "']\n";
}
ret += "]; \n";
ret += "graph = Flotr.draw(container,[\n";
for (int x = 0; x < data.GetLength(0); x++)
{
ret += "{ data : dl" + x + ", bars: {show: false}, lines: {show: true }, yaxis : 2 },\n";
ret += "{ data : d" + x + ", bars: {show: true, start: 'top', end: 'bottom'}, fillOpacity: 1.0, label : '" + data[x].label + "' },\n";
ret += "{ data : m" + x + ", bars: {show: false}, markers: { show: true, position: 'ct'}},\n";
}
ret += "], {\n";
ret += "legend : {\n";
ret += "backgroundColor : '#D2E8FF', \n";
ret += "position : 'se'";
ret += "},\n";
ret += "bars : {\n";
//.........这里部分代码省略.........
示例6: GenerateGraphBody
public string GenerateGraphBody(string id, Data[] data, string[] xlabel, string xtitle, string ytitle)
{
string ret = "";
int xlabel_max = 8;
ret += "<div id=\"" + id + "\"></div>\n";
ret += "<script>\n";
ret += "(function basic_axis(container) {\n";
for(int x=0;x<data.GetLength(0);x++) {
ret += "var d" + x + " = [";
for(int y=0;y<data[x].data.GetLength(0);y++) {
if(y != 0) {
ret += ",";
}
ret += "[" + y + "," + data[x].data[y] + "]";
}
ret += "];";
}
ret += "var ticks = [\n";
for (int i = 0; i < xlabel.Count(); i++)
{
if ((xlabel.Count() < xlabel_max) || (i == 0) || (i % (xlabel.Count() / xlabel_max) == 0))
{
if (i != 0)
{
ret += ",";
}
ret += "[" + i + ", '" + xlabel[i] + "']\n";
}
}
ret += "]; \n";
ret += "graph = Flotr.draw(container,[\n";
for(int x=0;x<data.GetLength(0);x++) {
ret += "{ data : d" + x + ", label : '" + data[x].label + "' ";
if(data[x].fill || data[x].show) {
ret += ", lines : { ";
if(data[x].show) {
ret += " show : true";
}
if (data[x].fill || data[x].show)
{
ret += ", ";
}
if(data[x].fill) {
ret += " fill : true";
}
ret += " } ";
}
if(data[x].show_point) {
ret += ", points : { show : true}";
}
ret += "},\n";
}
ret += "], {\n";
ret += "legend : {\n";
ret += "backgroundColor : '#D2E8FF', \n";
ret += "position : 'se'";
ret += "},\n";
ret += "yaxis : { title: \"" + ytitle + "\"},\n";
ret += "xaxis : { title: \"" + xtitle + "\", ticks : ticks, labelsAngle: 30},\n";
ret += "grid : {\n";
ret += "verticalLines : false,\n";
ret += "backgroundColor : {\n";
ret += "colors : [[0,'#fff'], [1,'#ccc']],\n";
ret += "start : 'top',\n";
ret += "end : 'bottom'\n";
ret += "}, \n";
ret += "}, \n";
ret += "HtmlText: false \n";
ret += "});\n";
ret += "})(document.getElementById(\"" + id + "\"));\n";
ret += "</script>\n";
return ret;
}