本文整理汇总了C#中TKChart.AddAxis方法的典型用法代码示例。如果您正苦于以下问题:C# TKChart.AddAxis方法的具体用法?C# TKChart.AddAxis怎么用?C# TKChart.AddAxis使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TKChart
的用法示例。
在下文中一共展示了TKChart.AddAxis方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ViewDidLoad
public override void ViewDidLoad ()
{
this.AddOption ("pin at top", top);
this.AddOption ("pin at left", left);
this.AddOption ("pin at right", right);
this.AddOption ("pin at bottom", bottom);
this.AddOption ("floating", floating);
base.ViewDidLoad ();
chart = new TKChart (this.View.Bounds);
chart.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
this.View.AddSubview (chart);
Random r = new Random ();
List<TKChartDataPoint> list1 = new List<TKChartDataPoint> ();
List<TKChartDataPoint> list2 = new List<TKChartDataPoint> ();
for (int i = 0; i < 26; i++) {
list1.Add (new TKChartDataPoint(new NSNumber(i+1), new NSNumber(r.Next(100))));
list2.Add (new TKChartDataPoint (new NSNumber (i + 1), new NSNumber (r.Next (60))));
}
TKChartNumericAxis xAxis = new TKChartNumericAxis(new NSNumber (1), new NSNumber (26));
xAxis.Position = TKChartAxisPosition.Bottom;
xAxis.MajorTickInterval = 5;
chart.AddAxis (xAxis);
TKChartAreaSeries series = new TKChartAreaSeries (list1.ToArray());
series.XAxis = xAxis;
chart.AddSeries (series);
TKChartAreaSeries series1 = new TKChartAreaSeries (list2.ToArray());
series1.XAxis = xAxis;
chart.AddSeries (series1);
chart.AllowTrackball = true;
chart.Trackball.SnapMode = TKChartTrackballSnapMode.AllClosestPoints;
chart.Delegate = chartDelegate;
chart.Trackball.Tooltip.Style.TextAlignment = UITextAlignment.Left;
}
示例2: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
TKChart chart = new TKChart (this.ExampleBounds);
chart.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
this.View.AddSubview (chart);
TKChartNumericAxis gdpInPoundsYAxis = new TKChartNumericAxis (new NSNumber(1050), new NSNumber(1400));
gdpInPoundsYAxis.MajorTickInterval = 50;
gdpInPoundsYAxis.Position = TKChartAxisPosition.Left;
gdpInPoundsYAxis.Style.LabelStyle.TextAlignment = TKChartAxisLabelAlignment.Left;
gdpInPoundsYAxis.Style.MajorTickStyle.TicksHidden = false;
gdpInPoundsYAxis.Style.LineHidden = false;
chart.AddAxis (gdpInPoundsYAxis);
chart.YAxis = gdpInPoundsYAxis;
TKChartDateTimeAxis periodXAxis = new TKChartDateTimeAxis ();
periodXAxis.MajorTickIntervalUnit = TKChartDateTimeAxisIntervalUnit.Years;
periodXAxis.MinorTickIntervalUnit = TKChartDateTimeAxisIntervalUnit.Years;
periodXAxis.MajorTickInterval = 1;
periodXAxis.Position = TKChartAxisPosition.Bottom;
periodXAxis.PlotMode = TKChartAxisPlotMode.BetweenTicks;
chart.AddAxis (periodXAxis);
TKChartNumericAxis gdpInvestmentYAxis = new TKChartNumericAxis (new NSNumber(0), new NSNumber(20));
gdpInvestmentYAxis.MajorTickInterval = 5;
gdpInvestmentYAxis.Position = TKChartAxisPosition.Right;
gdpInvestmentYAxis.Style.LabelStyle.TextAlignment = TKChartAxisLabelAlignment.Left;
gdpInvestmentYAxis.Style.MajorTickStyle.TicksHidden = false;
gdpInvestmentYAxis.Style.LineHidden = false;
chart.AddAxis (gdpInvestmentYAxis);
TKChartNumericAxis gdpGrowthUpAnnualChangeYAxis = new TKChartNumericAxis (new NSNumber(-6), new NSNumber(4));
gdpGrowthUpAnnualChangeYAxis.MajorTickInterval = 1;
gdpGrowthUpAnnualChangeYAxis.Position = TKChartAxisPosition.Right;
gdpGrowthUpAnnualChangeYAxis.Style.LabelStyle.TextAlignment = TKChartAxisLabelAlignment.Left;
gdpGrowthUpAnnualChangeYAxis.Style.MajorTickStyle.TicksHidden = false;
gdpGrowthUpAnnualChangeYAxis.Style.LineHidden = false;
chart.AddAxis (gdpGrowthUpAnnualChangeYAxis);
TKChartNumericAxis grossNationalSavingsAnnualGrowthUpYAxis = new TKChartNumericAxis (new NSNumber(0), new NSNumber(16));
grossNationalSavingsAnnualGrowthUpYAxis.MajorTickInterval = 2;
grossNationalSavingsAnnualGrowthUpYAxis.Position = TKChartAxisPosition.Right;
grossNationalSavingsAnnualGrowthUpYAxis.Style.LabelStyle.TextAlignment = TKChartAxisLabelAlignment.Left;
grossNationalSavingsAnnualGrowthUpYAxis.Style.MajorTickStyle.TicksHidden = false;
grossNationalSavingsAnnualGrowthUpYAxis.Style.LineHidden = false;
chart.AddAxis (grossNationalSavingsAnnualGrowthUpYAxis);
NSDate date2001 = DateWithYear (2001, 12, 31);
NSDate date2002 = DateWithYear (2002, 12, 31);
NSDate date2003 = DateWithYear (2003, 12, 31);
NSDate date2004 = DateWithYear (2004, 12, 31);
NSDate date2005 = DateWithYear (2005, 12, 31);
TKChartDataPoint[] gdpInPounds = new TKChartDataPoint[] {
new TKChartDataPoint(date2001, new NSNumber(1200)),
new TKChartDataPoint(date2002, new NSNumber(1200)),
new TKChartDataPoint(date2003, new NSNumber(1225)),
new TKChartDataPoint(date2004, new NSNumber(1300)),
new TKChartDataPoint(date2005, new NSNumber(1350))
};
TKChartColumnSeries gdpInPoundsSeries = new TKChartColumnSeries (gdpInPounds);
gdpInPoundsSeries.XAxis = periodXAxis;
gdpInPoundsSeries.YAxis = gdpInPoundsYAxis;
gdpInPoundsSeries.SelectionMode = TKChartSeriesSelectionMode.Series;
chart.AddSeries (gdpInPoundsSeries);
TKChartDataPoint[] gdpGrowthUpAnnual = new TKChartDataPoint[] {
new TKChartDataPoint (date2001, new NSNumber (4)),
new TKChartDataPoint (date2002, new NSNumber (3)),
new TKChartDataPoint (date2003, new NSNumber (2)),
new TKChartDataPoint (date2004, new NSNumber (-5)),
new TKChartDataPoint (date2005, new NSNumber (1))
};
float shapeSize = UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone ? 7 : 17;
TKChartLineSeries gdpGrowthUpSeries = new TKChartLineSeries (gdpGrowthUpAnnual);
gdpGrowthUpSeries.Style.PointShape = new TKPredefinedShape (TKShapeType.Circle, new SizeF (shapeSize, shapeSize));
gdpGrowthUpSeries.XAxis = periodXAxis;
gdpGrowthUpSeries.YAxis = gdpGrowthUpAnnualChangeYAxis;
gdpGrowthUpSeries.SelectionMode = TKChartSeriesSelectionMode.DataPoint;
gdpGrowthUpSeries.Style.ShapeMode = TKChartSeriesStyleShapeMode.AlwaysShow;
chart.AddSeries (gdpGrowthUpSeries);
TKChartDataPoint[] grossAnualSavings = new TKChartDataPoint[] {
new TKChartDataPoint (date2001, new NSNumber (14)),
new TKChartDataPoint (date2002, new NSNumber (8)),
new TKChartDataPoint (date2003, new NSNumber (12)),
new TKChartDataPoint (date2004, new NSNumber (11)),
new TKChartDataPoint (date2005, new NSNumber (16))
};
TKChartLineSeries grossAnualSavingsSeries = new TKChartLineSeries (grossAnualSavings);
grossAnualSavingsSeries.Style.PointShape = new TKPredefinedShape (TKShapeType.Circle, new SizeF(shapeSize, shapeSize));
grossAnualSavingsSeries.XAxis = periodXAxis;
grossAnualSavingsSeries.YAxis = grossNationalSavingsAnnualGrowthUpYAxis;
grossAnualSavingsSeries.SelectionMode = TKChartSeriesSelectionMode.DataPoint;
//.........这里部分代码省略.........
示例3: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
var chart = new TKChart (this.View.Bounds);
chart.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
this.View.Add (chart);
string url = "http://www.telerik.com/docs/default-source/ui-for-ios/weather.json?sfvrsn=2";
dataSource.LoadDataFromURL (url, TKDataSourceDataFormat.JSON, "dayList", (NSError err) => {
if (err != null) {
Console.WriteLine("Can't connect with the server!");
return;
}
dataSource.Settings.Chart.CreateSeries((TKDataSourceGroup group) => {
TKChartSeries series = null;
if (group.ValueKey == "clouds") {
series = new TKChartColumnSeries();
series.YAxis = new TKChartNumericAxis(NSObject.FromObject(0), NSObject.FromObject(100));
series.YAxis.Title = "clouds";
series.YAxis.Style.TitleStyle.RotationAngle = (float)Math.PI/2.0f;
}
else {
series = new TKChartLineSeries();
series.YAxis = new TKChartNumericAxis(NSObject.FromObject(-10), NSObject.FromObject(30));
if (group.ValueKey == "temp.min") {
series.YAxis.Position = TKChartAxisPosition.Right;
series.YAxis.Title = "temperature";
series.YAxis.Style.TitleStyle.RotationAngle = (float)Math.PI/2.0f;
chart.AddAxis(series.YAxis);
}
}
return series;
});
dataSource.Map((NSObject item) => {
double interval = ((NSNumber)item.ValueForKey(new NSString("dateTime"))).DoubleValue;
NSDate date = NSDate.FromTimeIntervalSince1970(interval);
item.SetValueForKey(date, new NSString("dateTime"));
return item;
});
NSObject[] items = this.dataSource.Items;
NSMutableArray newItems = new NSMutableArray();
newItems.Add(new TKDataSourceGroup(items, "clouds", "dateTime"));
newItems.Add(new TKDataSourceGroup(items, "temp.min", "dateTime"));
newItems.Add(new TKDataSourceGroup(items, "temp.max", "dateTime"));
dataSource.ItemSource = newItems;
chart.DataSource = dataSource;
var formatter = new NSDateFormatter();
formatter.DateFormat = "dd";
TKChartDateTimeAxis xAxis = (TKChartDateTimeAxis)chart.XAxis;
xAxis.MajorTickInterval = 1;
xAxis.PlotMode = TKChartAxisPlotMode.BetweenTicks;
xAxis.LabelFormatter = formatter;
xAxis.Title = "date";
xAxis.MinorTickIntervalUnit = TKChartDateTimeAxisIntervalUnit.Days;
});
}