lecho.lib.hellocharts.view.ColumnChartView Java Examples

The following examples show how to use lecho.lib.hellocharts.view.ColumnChartView. 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: BasalProfileEditor.java    From xDrip with GNU General Public License v3.0 6 votes vote down vote up
@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 #2
Source File: MainActivity.java    From HAPP with GNU General Public License v3.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    rootView                = inflater.inflate(R.layout.fragment_active_iobcob_barchart, container, false);
    iobcobChart             = (ColumnChartView) rootView.findViewById(R.id.iobcobchart);
    iobcobChart.setViewportCalculationEnabled(false);
    iobcobchartLoading      = (ProgressBar) rootView.findViewById(R.id.iobcobchartLoading);
    Viewport view           = iobcobChart.getMaximumViewport();
    view.top = 80;
    view.left = -1;
    view.right = 6;
    iobcobChart.setCurrentViewport(view);

    updateChart();

    return rootView;
}
 
Example #3
Source File: PreviewColumnChartActivity.java    From hellocharts-android with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    setHasOptionsMenu(true);
    View rootView = inflater.inflate(R.layout.fragment_preview_column_chart, container, false);

    chart = (ColumnChartView) rootView.findViewById(R.id.chart);
    previewChart = (PreviewColumnChartView) rootView.findViewById(R.id.chart_preview);

    // Generate data for previewed chart and copy of that data for preview chart.
    generateDefaultData();

    chart.setColumnChartData(data);
    // Disable zoom/scroll for previewed chart, visible chart ranges depends on preview chart viewport so
    // zoom/scroll is unnecessary.
    chart.setZoomEnabled(false);
    chart.setScrollEnabled(false);

    previewChart.setColumnChartData(previewData);
    previewChart.setViewportChangeListener(new ViewportListener());

    previewX(false);

    return rootView;
}
 
Example #4
Source File: DataChartActivity.java    From Memory-capsule with Apache License 2.0 5 votes vote down vote up
private void initColumnChart(){//创建柱状图
    columnChartView=new ColumnChartView(this);
    int columnWidth=(int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,400, getResources().getDisplayMetrics());
    int columnHeigth=(int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,400, getResources().getDisplayMetrics());
    RelativeLayout.LayoutParams columnChartParams=new RelativeLayout.LayoutParams(columnWidth,columnHeigth);
    columnChartParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
    columnChartParams.addRule(RelativeLayout.CENTER_VERTICAL);
    List<Column>columnList=new ArrayList<>();
    List<SubcolumnValue> values;
    for (int i=0;i<5;++i){
        values=new ArrayList<SubcolumnValue>();
        values.add(new SubcolumnValue((float)typesNum.get(i),colorData[i]));
        Column column=new Column(values);
        column.setHasLabels(false);
        column.setHasLabelsOnlyForSelected(true);
        columnList.add(column);
    }
    ColumnChartData columnChartData=new ColumnChartData(columnList);
    Axis axis=new Axis();
    Axis axiy=new Axis().setHasLines(true);
    List<AxisValue>axisValues=new ArrayList<>();
    for (int j=0;j<5;++j){
        axisValues.add(new AxisValue(j).setLabel(stateChar[j]));
    }
    axis.setValues(axisValues);
    axis.setName("类别");
    axiy.setName("数量");
    columnChartData.setAxisXBottom(axis);
    columnChartData.setAxisYLeft(axiy);
    columnChartView.setColumnChartData(columnChartData);
    relativeLayout.addView(columnChartView,columnChartParams);
}
 
Example #5
Source File: BasalProfileEditor.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
@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 #6
Source File: ColumnChartActivity.java    From hellocharts-android with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    setHasOptionsMenu(true);
    View rootView = inflater.inflate(R.layout.fragment_column_chart, container, false);

    chart = (ColumnChartView) rootView.findViewById(R.id.chart);
    chart.setOnValueTouchListener(new ValueTouchListener());

    generateData();

    return rootView;
}
 
Example #7
Source File: BasalChart.java    From xDrip with GNU General Public License v3.0 4 votes vote down vote up
public static void refreshAxis(final ColumnChartView chart) {
    chart.getChartData().setAxisYRight(chartYAxis(chart.getMaximumViewport().top));
}
 
Example #8
Source File: BasalChart.java    From xDrip-plus with GNU General Public License v3.0 4 votes vote down vote up
public static void refreshAxis(final ColumnChartView chart) {
    chart.getChartData().setAxisYRight(chartYAxis(chart.getMaximumViewport().top));
}
 
Example #9
Source File: LineColumnDependencyActivity.java    From hellocharts-android with Apache License 2.0 4 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_line_column_dependency, container, false);

    // *** TOP LINE CHART ***
    chartTop = (LineChartView) rootView.findViewById(R.id.chart_top);

    // Generate and set data for line chart
    generateInitialLineData();

    // *** BOTTOM COLUMN CHART ***

    chartBottom = (ColumnChartView) rootView.findViewById(R.id.chart_bottom);

    generateColumnData();

    return rootView;
}