本文整理汇总了C#中DashboardHelper.GenerateTable方法的典型用法代码示例。如果您正苦于以下问题:C# DashboardHelper.GenerateTable方法的具体用法?C# DashboardHelper.GenerateTable怎么用?C# DashboardHelper.GenerateTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DashboardHelper
的用法示例。
在下文中一共展示了DashboardHelper.GenerateTable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetShapeRangeValues
public void SetShapeRangeValues(DashboardHelper dashboardHelper, string shapeKey, string dataKey, string valueField, Color dotColor, int dotValue)
{
try
{
this.dotValue = dotValue;
this.dashboardHelper = dashboardHelper;
this.shapeKey = shapeKey;
this.dataKey = dataKey;
this.valueField = valueField;
this.dotColor = dotColor;
List<string> columnNames = new List<string>();
if (dashboardHelper.IsUsingEpiProject)
{
columnNames.Add("UniqueKey");
}
columnNames.Add(valueField);
columnNames.Add(dataKey);
DataTable loadedData;
if (valueField.Equals("{Record Count}"))
{
GadgetParameters gadgetOptions = new GadgetParameters();
gadgetOptions.MainVariableName = dataKey;
Dictionary<string, string> inputVariableList = new Dictionary<string, string>();
inputVariableList.Add("freqvar", dataKey);
inputVariableList.Add("allvalues", "false");
inputVariableList.Add("showconflimits", "false");
inputVariableList.Add("showcumulativepercent", "false");
inputVariableList.Add("includemissing", "false");
inputVariableList.Add("maxrows", "500");
gadgetOptions.InputVariableList = inputVariableList;
loadedData = dashboardHelper.GenerateFrequencyTable(gadgetOptions).First().Key;
foreach (DataRow dr in loadedData.Rows)
{
dr[0] = dr[0].ToString().Trim();
}
valueField = "freq";
}
else
{
loadedData = dashboardHelper.GenerateTable(columnNames);
}
GraphicsLayer graphicsLayer = myMap.Layers[layerId.ToString()] as GraphicsLayer;
List<double> valueList = new List<double>();
List<Graphic> graphicsToBeAdded = new List<Graphic>();
SpatialReference geoReference = new SpatialReference(4326);
for (int i = 0; i < graphicsLayer.Graphics.Count; i++)
{
Graphic graphicFeature = graphicsLayer.Graphics[i];
double xmin = graphicFeature.Geometry.Extent.XMin;
double xmax = graphicFeature.Geometry.Extent.XMax;
double ymin = graphicFeature.Geometry.Extent.YMin;
double ymax = graphicFeature.Geometry.Extent.YMax;
Random rnd = new Random();
string shapeValue = graphicFeature.Attributes[shapeKey].ToString().Replace("'", "''").Trim();
string filterExpression = "";
if (dataKey.Contains(" ") || dataKey.Contains("$") || dataKey.Contains("#"))
filterExpression += "[";
filterExpression += dataKey;
if (dataKey.Contains(" ") || dataKey.Contains("$") || dataKey.Contains("#"))
filterExpression += "]";
filterExpression += " = '" + shapeValue + "'";
double graphicValue = Double.PositiveInfinity;
try
{
graphicValue = Convert.ToDouble(loadedData.Select(filterExpression)[0][valueField]);
for (int counter = 0; counter < graphicValue; counter += dotValue)
{
bool pointInGraphic = false;
ExtendedGraphic graphic = new ExtendedGraphic();
while (!pointInGraphic)
{
double rndX = xmin + (rnd.NextDouble() * (xmax - xmin));
double rndY = ymin + (rnd.NextDouble() * (ymax - ymin));
graphic.Geometry = new MapPoint(rndX, rndY, geoReference);
graphic.Symbol = MarkerSymbol;
bool foundBottomLeft = false;
bool foundBottomRight = false;
bool foundTopLeft = false;
bool foundTopRight = false;
foreach (ESRI.ArcGIS.Client.Geometry.PointCollection pc in ((ESRI.ArcGIS.Client.Geometry.Polygon)graphicFeature.Geometry).Rings)
{
foundBottomLeft = pc.Any((point) => point.Y <= ((MapPoint)graphic.Geometry).Y && point.X <= ((MapPoint)graphic.Geometry).X);
foundBottomRight = pc.Any((point) => point.Y <= ((MapPoint)graphic.Geometry).Y && point.X >= ((MapPoint)graphic.Geometry).X);
foundTopLeft = pc.Any((point) => point.Y >= ((MapPoint)graphic.Geometry).Y && point.X <= ((MapPoint)graphic.Geometry).X);
foundTopRight = pc.Any((point) => point.Y >= ((MapPoint)graphic.Geometry).Y && point.X >= ((MapPoint)graphic.Geometry).X);
//.........这里部分代码省略.........
示例2: SetShapeRangeValues
public void SetShapeRangeValues(DashboardHelper dashboardHelper, string shapeKey, string dataKey, string valueField, List<SolidColorBrush> colors, int classCount)
{
try
{
this.classCount = classCount;
this.dashboardHelper = dashboardHelper;
this.shapeKey = shapeKey;
this.dataKey = dataKey;
this.valueField = valueField;
this.colors = colors;
List<string> columnNames = new List<string>();
if (dashboardHelper.IsUsingEpiProject)
{
columnNames.Add("UniqueKey");
}
columnNames.Add(valueField);
columnNames.Add(dataKey);
DataTable loadedData;
if (valueField.Equals("{Record Count}"))
{
GadgetParameters gadgetOptions = new GadgetParameters();
gadgetOptions.MainVariableName = dataKey;
Dictionary<string, string> inputVariableList = new Dictionary<string, string>();
inputVariableList.Add("freqvar", dataKey);
inputVariableList.Add("allvalues", "false");
inputVariableList.Add("showconflimits", "false");
inputVariableList.Add("showcumulativepercent", "false");
inputVariableList.Add("includemissing", "false");
inputVariableList.Add("maxrows", "500");
gadgetOptions.InputVariableList = inputVariableList;
loadedData = dashboardHelper.GenerateFrequencyTable(gadgetOptions).First().Key;
foreach (DataRow dr in loadedData.Rows)
{
dr[0] = dr[0].ToString().Trim();
}
valueField = "freq";
}
else
{
loadedData = dashboardHelper.GenerateTable(columnNames);
}
GraphicsLayer graphicsLayer = myMap.Layers[layerId.ToString()] as GraphicsLayer;
ThematicItem thematicItem = new ThematicItem() { Name = dataKey, Description = dataKey, CalcField = "" };
List<double> valueList = new List<double>();
for (int i = 0; i < graphicsLayer.Graphics.Count; i++)
{
Graphic graphicFeature = graphicsLayer.Graphics[i];
//string filterExpression = dataKey + " = '" + graphicFeature.Attributes[shapeKey].ToString().Trim() + "'";
string filterExpression = "";
if (dataKey.Contains(" ") || dataKey.Contains("$") || dataKey.Contains("#"))
filterExpression += "[";
filterExpression += dataKey;
if (dataKey.Contains(" ") || dataKey.Contains("$") || dataKey.Contains("#"))
filterExpression += "]";
filterExpression += " = '" + graphicFeature.Attributes[shapeKey].ToString().Replace("'", "''").Trim() + "'";
double graphicValue = Double.PositiveInfinity;
try
{
graphicValue = Convert.ToDouble(loadedData.Select(filterExpression)[0][valueField]);
}
catch (Exception ex)
{
graphicValue = Double.PositiveInfinity;
}
string graphicName = graphicFeature.Attributes[shapeKey].ToString();
if (i == 0)
{
thematicItem.Min = Double.PositiveInfinity;
thematicItem.Max = Double.NegativeInfinity;
thematicItem.MinName = string.Empty;
thematicItem.MaxName = string.Empty;
}
else
{
if (graphicValue < thematicItem.Min) { thematicItem.Min = graphicValue; thematicItem.MinName = graphicName; }
if (graphicValue > thematicItem.Max && graphicValue != Double.PositiveInfinity) { thematicItem.Max = graphicValue; thematicItem.MaxName = graphicName; }
}
if (graphicValue < Double.PositiveInfinity)
{
valueList.Add(graphicValue);
}
}
thematicItem.RangeStarts = new List<double>();
double totalRange = thematicItem.Max - thematicItem.Min;
double portion = totalRange / classCount;
thematicItem.RangeStarts.Add(thematicItem.Min);
double startRangeValue = thematicItem.Min;
IEnumerable<double> valueEnumerator =
//.........这里部分代码省略.........
示例3: GetCoordinates
private CustomCoordinateList GetCoordinates(DashboardHelper dashboardHelper, string latVar, string longVar, string timeVar)
{
List<string> columnNames = new List<string>();
if (dashboardHelper.IsUsingEpiProject)
columnNames.Add("UniqueKey");
columnNames.Add(latVar);
if (!columnNames.Exists(delegate(string s) { return s.Equals(longVar); }))
columnNames.Add(longVar);
if (!string.IsNullOrEmpty(timeVar))
{
if (!columnNames.Exists(delegate(string s) { return s.Equals(timeVar); }))
columnNames.Add(timeVar);
}
DataTable data = dashboardHelper.GenerateTable(columnNames);
minTime = DateTime.MaxValue;
maxTime = DateTime.MinValue;
minX = double.MaxValue;
maxX = double.MinValue;
minY = double.MaxValue;
maxY = double.MinValue;
CustomCoordinateList coordinateList = new CustomCoordinateList();
if (data != null)
{
foreach (DataRow row in data.Rows)
{
if (row[latVar] != DBNull.Value && row[longVar] != DBNull.Value)
{
double latitude = double.Parse(row[latVar].ToString());
double longitude = double.Parse(row[longVar].ToString());
if (latitude <= 90 && latitude >= -90 && longitude <= 180 && longitude >= -180)
{
int uniqueKey = 0;
if (dashboardHelper.IsUsingEpiProject)
uniqueKey = (int)row["UniqueKey"];
if (string.IsNullOrEmpty(timeVar))
{
coordinateList.Coordinates.Add(new CustomCoordinate(uniqueKey, latitude, longitude, null));
}
else if (!data.Columns.Contains(timeVar))
{
coordinateList.Coordinates.Add(new CustomCoordinate(uniqueKey, latitude, longitude, null));
}
else
{
if (row[timeVar] != DBNull.Value)
{
DateTime time = (DateTime)row[timeVar];
minTime = minTime < time ? minTime : time;
maxTime = maxTime > time ? maxTime : time;
coordinateList.Coordinates.Add(new CustomCoordinate(uniqueKey, latitude, longitude, time));
}
else
{
coordinateList.Coordinates.Add(new CustomCoordinate(uniqueKey, latitude, longitude, null));
}
}
minY = Math.Min(minY, latitude);
maxY = Math.Max(maxY, latitude);
minX = Math.Min(minX, longitude);
maxX = Math.Max(maxX, longitude);
}
}
}
}
return coordinateList;
}