我尝试在下面提到的链接中实现了作为示例提供的堆叠条。
每次运行此示例应用程序时,绘图的最大值始终采用红色。这是我得到的日志。
2014-02-13 13:04:18.347 CorePlotBarChartExample[3666:70b] {
"2012-05-01" = {
"Plot 1" = 7;
"Plot 2" = 7;
};
"2012-05-02" = {
"Plot 1" = 5;
"Plot 2" = 6;
};
"2012-05-03" = {
"Plot 1" = 7;
"Plot 2" = 9;
};
**"2012-05-04"** = {
**"Plot 1" = 10;**
**"Plot 2" = 4;**
};
**"2012-05-05" = {
"Plot 1" = 4;
"Plot 2" = 10;**
};
"2012-05-06" = {
"Plot 1" = 6;
"Plot 2" = 1;
};
"2012-05-07" = {
"Plot 1" = 8;
"Plot 2" = 6;
};
}
对于日期 2012-05-04 情节1值为10,采用红色。 对于日期 2012-05-05 Plot 2值为10,也是红色。[我当时期待蓝色]
我希望交换颜色,即 对于日期2012-05-04,地块1的值是10.我应该给出红色。 对于2012-05-05日期,Plot 2值为10.I应该给出蓝色。这是在模拟器中运行的图像的链接:
链接:http://i.stack.imgur.com/AhQaB.png
堆叠条形图的链接示例:https://github.com/gilthonweapps/CorePlotBarChartExample
也可以为任何人提供最好的链接/教程,使用核心情节的叠条?
答案 0 :(得分:0)
您需要使用委托方法:
-(CPTFill *)barFillForBarPlot:(CPTBarPlot *)barPlot recordIndex:(NSUInteger)index;
它为您提供条形图和索引,以便您可以使用它来查找数据源中的数据,如果符合您的条件,您可以设置正确的颜色。
答案 1 :(得分:0)
确保每个地图都有唯一的identifier
。在数据源中检查它,并确保返回正确绘图的值。