-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from mahlon-gumbs/feature/horizontalBarChart
Add support for Horizontal Bar Charts.
- Loading branch information
Showing
4 changed files
with
47 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React, {Component, PropTypes} from 'react'; | ||
import {requireNativeComponent, View} from 'react-native'; | ||
import BarChart from './BarChart'; | ||
|
||
class HorizontalBarChart extends BarChart { | ||
render() { | ||
return ( | ||
<MPHorizontalBarChart {...this.props}/> | ||
); | ||
} | ||
} | ||
|
||
var MPHorizontalBarChart = requireNativeComponent('MPHorizontalBarChart', HorizontalBarChart); | ||
|
||
export default HorizontalBarChart; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
android/src/main/java/cn/mandata/react_native_mpchart/MPHorizontalBarChartManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package cn.mandata.react_native_mpchart; | ||
|
||
import com.facebook.react.uimanager.ThemedReactContext; | ||
import com.github.mikephil.charting.charts.HorizontalBarChart; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Random; | ||
|
||
public class MPHorizontalBarChartManager extends MPBarChartManager { | ||
private String CLASS_NAME="MPHorizontalBarChart"; | ||
|
||
@Override | ||
public String getName() { | ||
return this.CLASS_NAME; | ||
} | ||
|
||
@Override | ||
protected HorizontalBarChart createViewInstance(ThemedReactContext reactContext) { | ||
HorizontalBarChart chart=new HorizontalBarChart(reactContext); | ||
new MPChartSelectionEventListener(chart); | ||
return chart; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
import BarChart from './BarChart.android'; | ||
import HorizontalBarChart from './HorizontalBarChart.android'; | ||
import LineChart from './LineChart.android'; | ||
import CandleStickChart from './CandleStickChart.android'; | ||
import CombinedChart from './CombinedChart.android'; | ||
import PieChart from './PieChart.android'; | ||
|
||
export { | ||
BarChart, | ||
LineChart, | ||
CandleStickChart, | ||
CombinedChart, | ||
PieChart | ||
BarChart, | ||
HorizontalBarChart, | ||
LineChart, | ||
CandleStickChart, | ||
CombinedChart, | ||
PieChart | ||
} |