Skip to content

Commit

Permalink
Merge pull request #64 from consenlabs/master
Browse files Browse the repository at this point in the history
Add more config for CombinedChart
  • Loading branch information
hongyin163 authored Dec 10, 2016
2 parents fc45036 + 518750d commit c124b4f
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 214 deletions.
168 changes: 89 additions & 79 deletions CombinedChart.js
Original file line number Diff line number Diff line change
@@ -1,96 +1,106 @@
import React, {Component, PropTypes} from 'react';
import {requireNativeComponent, View} from 'react-native';
import React, { Component, PropTypes } from 'react';
import { requireNativeComponent, View } from 'react-native';

class CombinedChart extends Component {
constructor(props) {
super(props);
constructor(props) {
super(props);
}

render() {
let chartData = {};
let children = this.props.children;
let { style, animateY, animateX, animateXY, ...other } = this.props;

if (children.length) {
for (var i = 0; i < children.length; i++) {
var child = children[i]
chartData[child.props.chartType] = child.props.data;
}
} else {
chartData[children.props.chartType] = children.props.data;
}

render() {
let chartData={};
let children=this.props.children;
if(children.length){
for (var i = 0; i < children.length; i++) {
var child=children[i]
chartData[child.props.chartType]=child.props.data;
}
}else{
chartData[children.props.chartType]=children.props.data;
}
let {
style,
data,
...other
}=this.props;
return (
<MPCombinedChart
style={this.props.style}
{...other}
data={chartData}/>
);
if (animateY) {
chartData.animateY = animateY
} else if (animateX) {
chartData.animateX = animateX
} else if (animateXY) {
chartData.animateXY = animateXY
}

return (
<MPCombinedChart
style={style}
{...other}
data={chartData}
/>
);
}
}

CombinedChart.propTypes = {
...View.propTypes,
data:PropTypes.object,
touchEnabled:PropTypes.bool,
dragEnabled:PropTypes.bool,
scaleEnabled:PropTypes.bool,
scaleXEnabled:PropTypes.bool,
scaleYEnabled:PropTypes.bool,
pinchZoom:PropTypes.bool,
doubleTapToZoomEnabled:PropTypes.bool,
highlightPerDragEnabled:PropTypes.bool,
highlightPerTapEnabled:PropTypes.bool,
dragDecelerationEnabled:PropTypes.bool,
dragDecelerationFrictionCoef:PropTypes.number,
maxVisibleValueCount:PropTypes.number,
limitLine:PropTypes.object,
description:PropTypes.string,
backgroundColor:PropTypes.string,
drawGridBackground:PropTypes.bool,
gridBackgroundColor:PropTypes.string,
visibleXRange:PropTypes.array,
borderColor:PropTypes.string,
borderWidth:PropTypes.number,
xAxis:PropTypes.object,
yAxisLeft:PropTypes.object,
yAxisRight:PropTypes.object,
yAxis:PropTypes.object,
fitScreen:PropTypes.bool,
chartPadding:PropTypes.string,
legend:PropTypes.object,
scaleX: PropTypes.number,
scaleY: PropTypes.number,
translateX: PropTypes.number,
translateY: PropTypes.number,
rotation: PropTypes.number,
renderToHardwareTextureAndroid: React.PropTypes.bool,
onLayout: React.PropTypes.bool,
accessibilityLiveRegion: React.PropTypes.string,
accessibilityComponentType: React.PropTypes.string,
importantForAccessibility: React.PropTypes.string,
accessibilityLabel: React.PropTypes.string,
testID: React.PropTypes.string,
viewCenter: React.PropTypes.array,
zoomTo: PropTypes.object,
extraOffsets: PropTypes.string
...View.propTypes,
data: PropTypes.object,
touchEnabled: PropTypes.bool,
dragEnabled: PropTypes.bool,
scaleEnabled: PropTypes.bool,
scaleXEnabled: PropTypes.bool,
scaleYEnabled: PropTypes.bool,
pinchZoom: PropTypes.bool,
doubleTapToZoomEnabled: PropTypes.bool,
highlightPerDragEnabled: PropTypes.bool,
highlightPerTapEnabled: PropTypes.bool,
dragDecelerationEnabled: PropTypes.bool,
dragDecelerationFrictionCoef: PropTypes.number,
maxVisibleValueCount: PropTypes.number,
limitLine: PropTypes.object,
description: PropTypes.string,
backgroundColor: PropTypes.string,
drawGridBackground: PropTypes.bool,
gridBackgroundColor: PropTypes.string,
visibleXRange: PropTypes.array,
borderColor: PropTypes.string,
borderWidth: PropTypes.number,
xAxis: PropTypes.object,
yAxisLeft: PropTypes.object,
yAxisRight: PropTypes.object,
yAxis: PropTypes.object,
fitScreen: PropTypes.bool,
chartPadding: PropTypes.string,
legend: PropTypes.object,
scaleX: PropTypes.number,
scaleY: PropTypes.number,
translateX: PropTypes.number,
translateY: PropTypes.number,
rotation: PropTypes.number,
renderToHardwareTextureAndroid: React.PropTypes.bool,
onLayout: React.PropTypes.bool,
accessibilityLiveRegion: React.PropTypes.string,
accessibilityComponentType: React.PropTypes.string,
importantForAccessibility: React.PropTypes.string,
accessibilityLabel: React.PropTypes.string,
testID: React.PropTypes.string,
viewCenter: React.PropTypes.array,
zoomTo: PropTypes.object,
extraOffsets: PropTypes.string,
animateY: PropTypes.object,
animateX: PropTypes.object,
animateXY: PropTypes.object,
};

class chart extends Component {
constructor(props) {
super(props);
}
render(){
return null;
}
constructor(props) {
super(props);
}
render() {
return null;
}
}
chart.propTypes = {
chartType:PropTypes.string,
data:PropTypes.object
chartType: PropTypes.string,
data: PropTypes.object,
};
CombinedChart.Chart=chart;
CombinedChart.Chart = chart;

// RIGHT_OF_CHART,
// RIGHT_OF_CHART_CENTER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,13 @@ private void setYAxisInfo(YAxis axis,ReadableMap v){
if(v.hasKey("spaceBottom")) axis.setSpaceBottom((float) (v.getDouble("spaceBottom")));

if(v.hasKey("showOnlyMinMax")) axis.setShowOnlyMinMax(v.getBoolean("showOnlyMinMax"));
if(v.hasKey("labelCount")) axis.setLabelCount(v.getInt("labelCount"), true);
if(v.hasKey("labelCount")) {
boolean labelCountForce = false;
if (v.hasKey("labelCountForce")) {
labelCountForce = v.getBoolean("labelCountForce");
}
axis.setLabelCount(v.getInt("labelCount"), labelCountForce);
}

if(v.hasKey("position")) {
String name=v.getString("position");
Expand Down
Loading

0 comments on commit c124b4f

Please sign in to comment.