lecho.lib.hellocharts.gesture.ContainerScrollType Java Examples
The following examples show how to use
lecho.lib.hellocharts.gesture.ContainerScrollType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LineCharts.java From MetalDetector with GNU General Public License v3.0 | 6 votes |
/** * 初始化视图 * */ protected void initView(LineChartView lineChartView) { pointValueList = new ArrayList<>(); linesList = new ArrayList<>(); //初始化坐标轴 axisY = new Axis(); axisX = new Axis(); lineChartData = initData(null); lineChartView.setLineChartData(lineChartData); Viewport port = initViewPort(0, 50,150); lineChartView.setCurrentViewportWithAnimation(port); lineChartView.setInteractive(false); lineChartView.setScrollEnabled(true); lineChartView.setValueTouchEnabled(true); lineChartView.setFocusableInTouchMode(true); lineChartView.setViewportCalculationEnabled(false); lineChartView.setContainerScrollEnabled(true, ContainerScrollType.HORIZONTAL); lineChartView.startDataAnimation(); points = new ArrayList<>(); }
Example #2
Source File: BasalProfileEditor.java From xDrip with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_basal_profile_editor); JoH.fixActionBar(this); // getSupportActionBar().setCustomView(R.layout.custom_action_bar_title); // getSupportActionBar().setDisplayShowCustomEnabled(true); chart = (ColumnChartView) findViewById(R.id.basalChart); basalSelectSpinner = findViewById(R.id.basalProfileSpinner); basalStepSpinner = findViewById(R.id.basalStepSpinner); setValue = (EditText) findViewById(R.id.basalSetText); setButton = (Button) findViewById(R.id.basalSetButton); plusButton = (Button) findViewById(R.id.basalPlusButton); minusButton = (Button) findViewById(R.id.basalMinusButton); chart.setDataAnimationListener(this); chart.setOnValueTouchListener(new ValueTouchListener()); chart.setColumnChartData(BasalChart.columnData()); autoSetViewPort(true); refreshScreenElements(); chart.setZoomType(ZoomType.HORIZONTAL); chart.setContainerScrollEnabled(true, ContainerScrollType.HORIZONTAL); //chart.setZoomLevel(0,0,1); chart.setMaxZoom(4f); chart.setZoomLevel(getNewMaxViewport().centerX(), getNewMaxViewport().centerY(), 1f); chart.setTapZoomEnabled(false); populateBasalStepSpinner(); }
Example #3
Source File: BasalProfileEditor.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_basal_profile_editor); JoH.fixActionBar(this); // getSupportActionBar().setCustomView(R.layout.custom_action_bar_title); // getSupportActionBar().setDisplayShowCustomEnabled(true); chart = (ColumnChartView) findViewById(R.id.basalChart); basalSelectSpinner = findViewById(R.id.basalProfileSpinner); basalStepSpinner = findViewById(R.id.basalStepSpinner); setValue = (EditText) findViewById(R.id.basalSetText); setButton = (Button) findViewById(R.id.basalSetButton); plusButton = (Button) findViewById(R.id.basalPlusButton); minusButton = (Button) findViewById(R.id.basalMinusButton); chart.setDataAnimationListener(this); chart.setOnValueTouchListener(new ValueTouchListener()); chart.setColumnChartData(BasalChart.columnData()); autoSetViewPort(true); refreshScreenElements(); chart.setZoomType(ZoomType.HORIZONTAL); chart.setContainerScrollEnabled(true, ContainerScrollType.HORIZONTAL); //chart.setZoomLevel(0,0,1); chart.setMaxZoom(4f); chart.setZoomLevel(getNewMaxViewport().centerX(), getNewMaxViewport().centerY(), 1f); chart.setTapZoomEnabled(false); populateBasalStepSpinner(); }
Example #4
Source File: MainActivity.java From healthgo with GNU General Public License v3.0 | 4 votes |
private void initLineChart() { Line line = new Line(mPointValues).setColor(Color.parseColor("#FFFAFA")); //折线的颜色(橙色) List<Line> lines = new ArrayList<>(); line.setShape(ValueShape.CIRCLE);//折线图上每个数据点的形状 这里是圆形 (有三种 :ValueShape.SQUARE ValueShape.CIRCLE ValueShape.DIAMOND) line.setCubic(false);//曲线是否平滑,即是曲线还是折线 line.setFilled(false);//是否填充曲线的面积 line.setHasLabels(true);//曲线的数据坐标是否加上备注 // line.setHasLabelsOnlyForSelected(true);//点击数据坐标提示数据(设置了这个line.setHasLabels(true);就无效) line.setHasLines(true);//是否用线显示。如果为false 则没有曲线只有点显示 line.setHasPoints(true);//是否显示圆点 如果为false 则没有原点只有点显示(每个数据点都是个大的圆点) lines.add(line); LineChartData data = new LineChartData(); data.setLines(lines); //坐标轴 Axis axisX = new Axis(); //X轴 axisX.setHasTiltedLabels(true); //X坐标轴字体是斜的显示还是直的,true是斜的显示 axisX.setTextColor(Color.WHITE); //设置字体颜色 //axisX.setName("date"); //表格名称 axisX.setTextSize(10);//设置字体大小 axisX.setMaxLabelChars(8); //最多几个X轴坐标,意思就是你的缩放让X轴上数据的个数7<=x<=mAxisXValues.length axisX.setValues(mAxisXValues); //填充X轴的坐标名称 data.setAxisXBottom(axisX); //x 轴在底部 //data.setAxisXTop(axisX); //x 轴在顶部 axisX.setHasLines(true); //x 轴分割线 // Y轴是根据数据的大小自动设置Y轴上限(在下面我会给出固定Y轴数据个数的解决方案) Axis axisY = new Axis(); axisY.setName("");//y轴标注 // axisY.setTextSize(10);//设置字体大小 axisY.setTextColor(Color.parseColor("#ffffff")); data.setAxisYLeft(axisY); //Y轴设置在左边 //data.setAxisYRight(axisY); //y轴设置在右边 //设置行为属性,支持缩放、滑动以及平移 lineChart.setInteractive(true); lineChart.setZoomType(ZoomType.HORIZONTAL); lineChart.setMaxZoom((float) 2);//最大方法比例 lineChart.setContainerScrollEnabled(true, ContainerScrollType.HORIZONTAL); lineChart.setLineChartData(data); lineChart.setVisibility(View.VISIBLE); /**注:下面的7,10只是代表一个数字去类比而已 * 当时是为了解决X轴固定数据个数。见(http://forum.xda-developers.com/tools/programming/library-hellocharts-charting-library-t2904456/page2); */ // Viewport v = new Viewport(lineChart.getMaximumViewport()); // v.left = 0; // v.right= 7; // lineChart.setCurrentViewport(v); }
Example #5
Source File: AbstractChartView.java From hellocharts-android with Apache License 2.0 | 4 votes |
@Override public void setContainerScrollEnabled(boolean isContainerScrollEnabled, ContainerScrollType containerScrollType) { this.isContainerScrollEnabled = isContainerScrollEnabled; this.containerScrollType = containerScrollType; }
Example #6
Source File: Chart.java From hellocharts-android with Apache License 2.0 | 2 votes |
/** * Set isContainerScrollEnabled to true and containerScrollType to HORIZONTAL or VERTICAL if you are using chart * within scroll container. */ public void setContainerScrollEnabled(boolean isContainerScrollEnabled, ContainerScrollType containerScrollType);