本文整理汇总了C#中DataPoint.SetValueY方法的典型用法代码示例。如果您正苦于以下问题:C# DataPoint.SetValueY方法的具体用法?C# DataPoint.SetValueY怎么用?C# DataPoint.SetValueY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataPoint
的用法示例。
在下文中一共展示了DataPoint.SetValueY方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
var answers = DataFacade.GetData<Answers>(d => d.QuestionRef == QuestionId);
int totalVotes = answers.Sum(d => d.TotalVotes);
if (totalVotes > 0)
{
QuickPollResultChart.Titles.Add("Voters: " + totalVotes.ToString());
foreach (var answer in answers)
{
DataPoint point = new DataPoint();
point.SetValueY(new object[] { (double)answer.TotalVotes / (double)totalVotes });
point.LegendText = answer.AnswerText;
QuickPollResultChart.Series["Default"].Points.Add(point);
}
// Enable 3D
QuickPollResultChart.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true;
QuickPollResultChart.Series["Default"]["CollectedThresholdUsePercent"] = "true";
}
}
示例2: Page_Load
/// <summary>
/// Occurs on the page load. Binds the data and initializes the page controls.
/// </summary>
/// <param name="sender">
/// The sender.
/// </param>
/// <param name="e">
/// The event arguments.
/// </param>
protected void Page_Load(object sender, EventArgs e)
{
List<int> routeIds;
var userGuid = (Guid)Membership.GetUser().ProviderUserKey;
_routeManager = new RoutesManager(userGuid);
if (BindRoutes(out routeIds))
{
return;
}
InitializeChart(chtElevationGain, "Routepunkte", "Meters");
InitializeChart(chtSpeed, "Routepunkte", "Km/h");
//Elevation
for (int i = 0; i < routeIds.Count; i++)
{
var route = this._routeManager.GetByIdForCurrentUser(routeIds[i]);
if (i >= chtElevationGain.Series.Count)
{
var series = chtElevationGain.Series.Add(route.Id.ToString());
series.LegendText = route.Name;
series.ChartType = SeriesChartType.Spline;
series.Legend = chtElevationGain.Legends[0].Name;
}
if (i >= chtSpeed.Series.Count)
{
var series = chtSpeed.Series.Add(route.Id.ToString());
series.LegendText = route.Name;
series.ChartType = SeriesChartType.Spline;
series.Legend = chtSpeed.Legends[0].Name;
}
for (var j = 0; j < route.TrackPoints.Count; j++)
{
var dp = new DataPoint
{
Label =
route.TrackPoints[j].Elevation.ToString(CultureInfo.InvariantCulture),
Color = _colors[route.Id % _colors.Length],
BorderWidth = 2,
LabelForeColor = Color.Orange,
LabelBackColor = Color.DarkBlue,
IsValueShownAsLabel = true,
XValue = j
};
dp.SetValueY(route.TrackPoints[j].Elevation);
chtElevationGain.Series[i].Points.Add(dp);
}
chtElevationGain.Series[route.Id.ToString()].Color = _colors[route.Id % _colors.Length];
chtSpeed.Series[route.Id.ToString()].Color = _colors[route.Id % _colors.Length];
//Speed
for (var j = 0; j < route.SpeedStages.Count; j++)
{
var dp = new DataPoint
{
Label = route.SpeedStages[j].ToString("0.0", CultureInfo.InvariantCulture),
Color = _colors[route.Id % _colors.Length],
BorderWidth = 2,
LabelForeColor = Color.Orange,
LabelBackColor = Color.DarkBlue,
IsValueShownAsLabel = true,
XValue = j
};
dp.SetValueY(route.SpeedStages[j]);
chtSpeed.Series[i].Points.Add(dp);
}
}
chtElevationGain.DataBind();
chtSpeed.DataBind();
}