iOSPlot:如何在同一视图上显示多个图表?

发布于 2024-11-09 15:18:41 字数 342 浏览 0 评论 0原文

我正在开发一个需要图表的 iPhone 应用程序。因此我使用名为 iOSPlot 的 API 来绘制折线图。

我已经从此链接下载了 API

https://github.com/hon Cheng/iOSPlot

图表显示正常。

我想在同一视图中将一个图表显示在另一个图表的下方。

我怎样才能做到这一点?

我想它正在 UIView 上打印出图表,并且根据我的要求,图表可能超过 1 个。

那么如何在同一视图上显示多个图表呢?

I am developing an iPhone app which requires charts. Hence I am using API called iOSPlot to draw line charts.

I have downloaded API from this link

https://github.com/honcheng/iOSPlot

Graph appears fine.

I want to display one graph below the other on the same view.

How can I do that?

I suppose it is printing out the charts on UIView and as per my requirement the charts could be more than 1.

So how can I display more than one chart on the same view?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

昨迟人 2024-11-16 15:18:41

它不起作用?

PCHalfPieChart *pieChart1 = [[PCHalfPieChart alloc] initWithFrame:CGRectMake(10, 10, 50, 50)];
[self.view addSubview:pieChart1];
// adding dataset1 to pieChart1

PCHalfPieChart *pieChart2 = [[PCHalfPieChart alloc] initWithFrame:CGRectMake(70, 10, 50, 50)];
[self.view addSubview:pieChart2];
// adding dataset2 to pieChart2

或者这样:

PCLineChartView * lineChart;

// you should find a way to define your x, y, width and height correctly.
// I have not enough information about your project to find a solution
// I admit that there is 4 var called x, y, width and height

for (int i=0; i < numberOfChart; i++) {
    lineChart = [[PCLineChartView alloc] initWithFrame:CGRectMake(x, y, width, height)];
    // Add some data
    // it can be based on the index to define which data goes to which chart
    // ...

    [self.view addSubview: lineChart];
    [lineChart release];

    // Changing values of x, y, width and height
    // should come here
}

It is not working?

PCHalfPieChart *pieChart1 = [[PCHalfPieChart alloc] initWithFrame:CGRectMake(10, 10, 50, 50)];
[self.view addSubview:pieChart1];
// adding dataset1 to pieChart1

PCHalfPieChart *pieChart2 = [[PCHalfPieChart alloc] initWithFrame:CGRectMake(70, 10, 50, 50)];
[self.view addSubview:pieChart2];
// adding dataset2 to pieChart2

Or this way:

PCLineChartView * lineChart;

// you should find a way to define your x, y, width and height correctly.
// I have not enough information about your project to find a solution
// I admit that there is 4 var called x, y, width and height

for (int i=0; i < numberOfChart; i++) {
    lineChart = [[PCLineChartView alloc] initWithFrame:CGRectMake(x, y, width, height)];
    // Add some data
    // it can be based on the index to define which data goes to which chart
    // ...

    [self.view addSubview: lineChart];
    [lineChart release];

    // Changing values of x, y, width and height
    // should come here
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文