Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/danielgindi/Charts
Browse files Browse the repository at this point in the history
* 'master' of https://github.com/danielgindi/Charts:
  Fix broken demo link in readme (ChartsOrg#3440)
  update candle chart view options in demo project to toggle showing candle bar (ChartsOrg#3424)
  add seperator set drag for x axis and y axis for Objective-c (ChartsOrg#3421)
  • Loading branch information
FreddyZeng committed May 11, 2018
2 parents e58c8fe + cc73ba7 commit fe6b086
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
10 changes: 10 additions & 0 deletions ChartsDemo-iOS/Objective-C/Demos/CandleStickChartViewController.m
Expand Up @@ -41,6 +41,7 @@ - (void)viewDidLoad
@{@"key": @"togglePinchZoom", @"label": @"Toggle PinchZoom"},
@{@"key": @"toggleAutoScaleMinMax", @"label": @"Toggle auto scale min/max"},
@{@"key": @"toggleShadowColorSameAsCandle", @"label": @"Toggle shadow same color"},
@{@"key": @"toggleShowCandleBar", @"label": @"Toggle show candle bar"},
@{@"key": @"toggleData", @"label": @"Toggle Data"},
];

Expand Down Expand Up @@ -132,6 +133,15 @@ - (void)optionTapped:(NSString *)key
set.shadowColorSameAsCandle = !set.shadowColorSameAsCandle;
}

[_chartView notifyDataSetChanged];
return;
} else if ([key isEqualToString:@"toggleShowCandleBar"])
{
for (id<ICandleChartDataSet> set in _chartView.data.dataSets)
{
set.showCandleBar = !set.showCandleBar;
}

[_chartView notifyDataSetChanged];
return;
}
Expand Down
2 changes: 2 additions & 0 deletions ChartsDemo-iOS/Swift/DemoBaseViewController.swift
Expand Up @@ -23,6 +23,7 @@ enum Option {
case toggleBarBorders
// CandleChart
case toggleShadowColorSameAsCandle
case toggleShowCandleBar
// CombinedChart
case toggleLineValues
case toggleBarValues
Expand Down Expand Up @@ -60,6 +61,7 @@ enum Option {
case .toggleBarBorders: return "Toggle Bar Borders"
// CandleChart
case .toggleShadowColorSameAsCandle: return "Toggle shadow same color"
case .toggleShowCandleBar: return "Toggle show candle bar"
// CombinedChart
case .toggleLineValues: return "Toggle Line Values"
case .toggleBarValues: return "Toggle Bar Values"
Expand Down
11 changes: 9 additions & 2 deletions ChartsDemo-iOS/Swift/Demos/CandleStickChartViewController.swift
Expand Up @@ -32,6 +32,7 @@ class CandleStickChartViewController: DemoBaseViewController {
.togglePinchZoom,
.toggleAutoScaleMinMax,
.toggleShadowColorSameAsCandle,
.toggleShowCandleBar,
.toggleData]

chartView.delegate = self
Expand Down Expand Up @@ -103,12 +104,18 @@ class CandleStickChartViewController: DemoBaseViewController {
}

override func optionTapped(_ option: Option) {
if .toggleShadowColorSameAsCandle ~= option {
switch option {
case .toggleShadowColorSameAsCandle:
for set in chartView.data!.dataSets as! [CandleChartDataSet] {
set.shadowColorSameAsCandle = !set.shadowColorSameAsCandle
}
chartView.notifyDataSetChanged()
} else {
case .toggleShowCandleBar:
for set in chartView.data!.dataSets as! [CandleChartDataSet] {
set.showCandleBar = !set.showCandleBar
}
chartView.notifyDataSetChanged()
default:
super.handleOption(option, forChartView: chartView)
}
}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -187,7 +187,7 @@ Documentation
Currently there's no need for documentation for the iOS/tvOS/macOS version, as the API is **95% the same** as on Android.
You can read the official [MPAndroidChart](https://github.com/PhilJay/MPAndroidChart) documentation here: [**Wiki**](https://github.com/PhilJay/MPAndroidChart/wiki)

Or you can see the [**ChartsDemo**](https://github.com/danielgindi/Charts/tree/master/ChartsDemo) project and learn the how-tos from it.
Or you can see the Charts Demo project in both Objective-C and Swift ([**ChartsDemo-iOS**](https://github.com/danielgindi/Charts/tree/master/ChartsDemo-iOS), as well as macOS [**ChartsDemo-macOS**](https://github.com/danielgindi/Charts/tree/master/ChartsDemo-macOS)) and learn the how-tos from it.


Special Thanks
Expand Down
4 changes: 2 additions & 2 deletions Source/Charts/Charts/BarLineChartViewBase.swift
Expand Up @@ -1539,7 +1539,7 @@ open class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChartD
}

/// is dragging on the X axis enabled?
open var dragXEnabled: Bool
@objc open var dragXEnabled: Bool
{
get
{
Expand All @@ -1552,7 +1552,7 @@ open class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChartD
}

/// is dragging on the Y axis enabled?
open var dragYEnabled: Bool
@objc open var dragYEnabled: Bool
{
get
{
Expand Down

0 comments on commit fe6b086

Please sign in to comment.