Skip to content

Commit

Permalink
Merge pull request #41 from mahlon-gumbs/feature/horizontalBarChart
Browse files Browse the repository at this point in the history
Add support for Horizontal Bar Charts.
  • Loading branch information
hongyin163 authored Oct 10, 2016
2 parents e9724ca + dd3ee2f commit 4b4fea8
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 5 deletions.
15 changes: 15 additions & 0 deletions HorizontalBarChart.android.js
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;
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public List<ViewManager> createViewManagers(ReactApplicationContext reactContext
return Arrays.<ViewManager>asList(
new ChartViewManager(),
new MPBarChartManager(),
new MPHorizontalBarChartManager(),
new MPLineChartManager(),
new MPCombinedChartManager(),
new MPCandleStickChartManager(),
Expand Down
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;
}

}
12 changes: 7 additions & 5 deletions index.android.js
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
}

0 comments on commit 4b4fea8

Please sign in to comment.