Closed GoogleCodeExporter closed 9 years ago
Each bar plot is a CALayer that covers the whole plot area. If you have a large
plot area and 12 plots, that could be a problem. If all of the bars are the
same width, you could use a single bar plot and implement some of the following
datasource methods (no more than one from each group) to customize the look of
each bar:
-(NSArray *)barFillsForBarPlot:(CPTBarPlot *)barPlot
recordIndexRange:(NSRange)indexRange;
-(CPTFill *)barFillForBarPlot:(CPTBarPlot *)barPlot recordIndex:(NSUInteger)idx;
-(NSArray *)barLineStylesForBarPlot:(CPTBarPlot *)barPlot
recordIndexRange:(NSRange)indexRange;
-(CPTLineStyle *)barLineStyleForBarPlot:(CPTBarPlot *)barPlot
recordIndex:(NSUInteger)idx;
Original comment by eskr...@mac.com
on 18 Jun 2013 at 1:07
but if I use array like this
self.plotData = (
(
1271871,
0,
0,
0,
0,
0,
409,
"0.9",
48,
24
),
(
935898,
0,
0,
0,
0,
45265734,
947,
"0.4",
31,
5
),
(
550638,
0,
0,
0,
0,
25924794,
462,
"0.8",
47,
12
),
(
474930,
0,
0,
0,
0,
52197572,
437,
"0.8",
38,
6
),
ect
what method is better use?
Previous I use
-(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum
recordIndex:(NSUInteger)index;
and create 10 (according to this array) CPTBarChart?
I have tried to use
- (NSArray *)numbersForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum
recordIndexRange:(NSRange)indexRange
but this method calls 2 time (x and y axis?)
how i can call this method self.plotData.count times for example - not only 2
times?
Original comment by IrDidkov...@gmail.com
on 18 Jun 2013 at 8:15
Your datasource method should check the field parameter. Each plot will call
the datasource for each field it needs; a bar plot typically requires bar
locations and bar tip values. Depending on the setup, the location can be
optional or it can request the base value for each bar, too.
There are other optional datasource methods. You can use
-dataForPlot:recordIndexRange: to give the plot all of the data in one shot,
but whether that is useful or not depends on how you've stored the data in your
model.
Original comment by eskr...@mac.com
on 19 Jun 2013 at 1:50
I have read that "field" is it axis, and to add new axis i have to use
self.graph.axisSet.axes = [NSArray arrayWithObjects:x, y, y2, nil]; something
like that
or may be I can use another way?
way to create a lot of BarCharts is not good because i have got memory warning
like i wrote earlier
for (int i = 0; i < array.count; i++)
{
CPTBarChart *barChart = [CHTBarChart alloc] init];
//some parameters
[barChart release];
}
Thx for help
Original comment by IrDidkov...@gmail.com
on 19 Jun 2013 at 9:21
For bar charts, the field will be one of the following:
typedef enum _CPTBarPlotField {
CPTBarPlotFieldBarLocation,
CPTBarPlotFieldBarTip,
CPTBarPlotFieldBarBase
}
CPTBarPlotField;
The base value is used only when barBasesVary is YES. This lets you do things
like stacked plots.
Original comment by eskr...@mac.com
on 19 Jun 2013 at 11:48
I have tried to use CPTBarPlotFieldBarBase but
- (NSArray *)numbersForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum
recordIndexRange:(NSRange)indexRange
calls one time
if I use loop like this
for (int i = 0; i < array.count; i++)
{
CPTBarChart *barChart = [CHTBarChart alloc] init];
//some parameters
[self.graph addPlot:barPlot toPlotSpace:plotSpace];
[barChart release];
}
in case a lot of bars in chart and a lot of chart on one graph i get a crash (
can you help me how i can create big chart with a lot of barCharts?
Original comment by IrDidkov...@gmail.com
on 1 Jul 2013 at 8:44
An iPhone 4 is going to be pretty tight on memory and performance will suffer
with lots of large layers (each plot is separate CALayer). As I mentioned in
comment #1, set the bar positions and appearance to display all of the bars in
a single bar plot.
Original comment by eskr...@mac.com
on 1 Jul 2013 at 11:27
Original comment by eskr...@mac.com
on 20 Jul 2013 at 2:40
Original issue reported on code.google.com by
IrDidkov...@gmail.com
on 17 Jun 2013 at 3:04Attachments: