v3.0.0
版本发布时间: 2016-10-19 23:56:20
ChartsOrg/Charts最新发布版本:5.1.0(2024-02-16 12:08:54)
This is a major release, with a few breaking changes. So please pay attention.
Updates:
-
x-index
es are dead. Intoducing: x-values. Each entry now has anx
and ay
. - Pie/radar charts do not have a concept of X index anymore
- Unified XAxis/YAxis features and experience.
- Unified formatter interfaces for axes.
- New formatter for
y
values, not inheriting from NSNumberFormatter anymore, to have dataSet and viewport information to take better formatting decisions. - Major refactoring of the Highlight mechanism.
- Refactored marker mechanism
- Refactored legend entry mechanism
- Each dataset can now set its own legend form/size/etc.
- More demos
- Some classes have been renamed, keeping the namespaced name only in ObjC (using Swift 2.2
objc(...)
feature, and the change of a major version update) -
FillFormatter
now has a block representation usingFillFormatter.withblock(...)
- Same goes for all Default formatters too.
- No more
saveToCameraRoll()
. Since Xcode 8.0 it causes "privacy" issues with Apple Review, you have to add the photo albums privacy key to yourInfo.plist
for that. - Moved to Swift 3.0. Make sure your project conforms to Swift 3.0.
- Many minor bug fixes and improvements
Breaking changes / how to migrate:
- All dataset constructors have changed - they do not take an array of x-indices anymore.
- All entry constructors have changed - they take in an X and a Y.
- Pie and Radar chart entries now have their own classes. So exchange the Entry classes with
PieChartDataEntry
/RadarChartDataEntry
- If you have any old
startAtZeroEnabled
calls - these have been deprecated for a long time. Replace them withaxisMinimum
. - If you are using formatters:
- Replace any
chart.valueFormatter = formatter
withchart.valueFormatter = ChartDefaultValueFormatter(formatter: formatter)
orchart.valueFormatter = [[ChartDefaultValueFormatter alloc] initWithFormatter:formatter];
- Replace any
axis.valueFormatter = formatter
withaxis.valueFormatter = ChartDefaultAxisValueFormatter(formatter: formatter)
oraxis.valueFormatter = [[ChartDefaultAxisValueFormatter alloc] initWithFormatter:formatter];
- Replace any
- In general, all functions that accepted x-indices before, now accept an x-value, so you might have to adjust the names a little bit.
- Where
ChartViewDelegate
is implemented, update thechartValueSelected
interface - Replace
drawSliceTextEnabled
withdrawEntryLabelsEnabled
- If you have a custom scatter shape - implement an
IShapeRenderer
, and put your rendering code in there - If you have a custom marker - consider subclassing
MarkerView
/MarkerImage
or implementingIMarker
. There are more options than before now... - If you have used
barSpace
before, move to usingbarWidth
- If you used
saveToCameraRoll()
, replace withUIImageWriteToSavedPhotosAlbum(chart.getChartImage(trasparent: false), nil, nil, nil)
- Some classes have been renamed for a cleaner look. They do not contain the "Chart" prefix anymore. That's for Swift only, where there are namespaces. In ObjC the names stayed the same for the sake of namespacing, using Swift 2.2's feature of
@objc(name)
. If your compiler yells that a class does not exist, try to remove the Chart from its name. This should rarely happen, as we've chosen only the classes that are rarely instantiated by the user.