I had originally begun development on my chart class for BabyBubbles, which required customizable charts to display various statistics on whatever babies you might have. At that time all of the view building and logic was contained in a view controller, DTChartViewController. This app was the first to launch with the 1.0 version and I’ve never had any complaints.
When I continued work on iWoman 2.0 I realized that it would make more sense to make the box with the chart a view of its own. Especially because I wanted to have the ability to show a small chart which would zoom to use the full screen when rotating your device. So I got to work on 2.0. Amongst other polishing I wanted to clean up the delegate/datasource interface to use method names that inform the developer that they belong to DTChartView.
That’s how the datasource protocol turned out. You can see that very little is required to get a chart to show, but there is a boatload of options to customize the appearance of the columns and lines.
@protocol DTChartDataSource @required - (NSUInteger)numberOfPointsInChartView:(DTChartView *)chartView; - (CGFloat)maximumValueInChartView:(DTChartView *)chartView; - (CGFloat)chartView:(DTChartView *)chartView valueForPointAtPosition:(DTChartDataPointPosition)position; @optional - (NSInteger)numberOfLinesInChartView:(DTChartView *)chartView; /* default 1 */ - (CGSize)unitSizeInChartView:(DTChartView *)chartView;; // default: automatically calculated - (CGFloat)minimumValueInChartView:(DTChartView *)chartView; // default: 0 - (NSArray *)chartView:(DTChartView *)chartView arrayOfValuesForBarsAtPosition:(DTChartDataPointPosition)position; // column grouping - (NSUInteger)chartView:(DTChartView *)chartView groupForColumn:(NSUInteger)column; /* column grouping */ // customizing look - (UIColor *)chartView:(DTChartView *)chartView backgroundColorBehindPointAtColumn:(NSUInteger)column; /* no fill if not implemented */ - (UIColor *)chartView:(DTChartView *)chartView colorForLineAtIndex:(NSUInteger)index; /* default colors are provided */ - (BOOL)chartView:(DTChartView *)chartView drawCustomBarInRect:(CGRect)barRect onContext:(CGContextRef)context forLineIndex:(NSUInteger)lineIndex; // custom drawing of bars - (BOOL)chartView:(DTChartView *)chartView drawCustomBackgroundInRect:(CGRect)barRect onContext:(CGContextRef)context backgroundType:(DTChartBackgroundType)backgroundType; - (BOOL)chartView:(DTChartView *)chartView drawCustomDataPointAtPoint:(CGPoint)point onContext:(CGContextRef)context position:(DTChartDataPointPosition)position; // horizontal axis customization - (NSString *)chartView:(DTChartView *)chartView textForLabelInColumn:(NSUInteger)column; - (BOOL)chartView:(DTChartView *)chartView customizeColumnLabel:(UILabel *)label; // vertical axis label formatting - (NSString *)chartView:(DTChartView *)chartView titleForLabelAtValue:(CGFloat)value; // custom formatting for y-axis labels // legend - (NSString *)chartView:(DTChartView *)chartView titleForLineAtIndex:(NSUInteger)index; // name for legend // display of placeholder for empty chart - (UIView *)viewForEmptyChartView:(DTChartView *)chartView; - (NSString *)titleForEmptyChartView:(DTChartView *)chartView; @end |
In the meantime another customer found DTChartView and purchased it. Every time this happens, this invigorates me and prompts me to to polish just a bit more. Helmut Neumann took it upon himself to take the 2.0 BETA and add it to the latest version of his successful cellphone usage tracking app.
Without any fear or reservation he pointed out all the shortcomings and drove me to iron out all those kinks. So finally, when he got the update approved it was at the same time the seal of approval that I wanted to get to allow myself to release version 2.0.
I’m always happy to hear when customers of the Dr. Touch’s Parts Store report on how happy my work made them.
“Two months ago i wanted to add Charts to HandyEtat, my well settled cost control app for T-Mobile Germany. I was already using My App Sales and liked the integrated charts. So I was quite happy to find DTChartView in Olivers parts store, espacially when noticing the unbeatable price and license conditions. DTChartView is feature rich, highly customizable and rock solid in execution. Integrating it into my App was “a piece of cake”. Oliver showed a great performance on taking over and implementing enhancement requests. The new version of HandyEtat got an overwhelming response from my customers, so I am very pleased with my decision to use DTChartView.”
DTChartView 2.0 is available on my Dr. Touch’s Parts Store. I’ve priced it so high because of the enormous amount of work that went into it, knowing well that this would limit the number of apps using it. But on the other hand it makes it a charting solution that can make your app stand apart from the competition.