lecho / hellocharts-android

Charts library for Android compatible with API 8+, several chart types with scaling, scrolling and animations 📊
Apache License 2.0
7.44k stars 1.61k forks source link

Lines shrinks after changing LineChartData #357

Open m-bacevicius opened 7 years ago

m-bacevicius commented 7 years ago

Lines shrink down after changing LineChartData in top chart in Linechart Dependency chart. Any ideas, what am I doing wrong?

lecho commented 7 years ago

Hi, could you some code simple?

m-bacevicius commented 7 years ago

Sure, I'm sending the whole Activity code:

package inducesmile.com.androidtabwithswipe;

import android.app.Activity; import android.app.ProgressDialog; import android.content.Context; import android.content.SharedPreferences; import android.graphics.Color; import android.os.AsyncTask; import android.os.Bundle; import android.preference.PreferenceManager; import android.util.Log; import android.view.View; import android.view.WindowManager; import android.widget.AdapterView; import android.widget.Toast;

import com.example.ComputerOuterClass; import com.example.computerServiceGrpc;

import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.Locale; import java.util.Map;

import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; import lecho.lib.hellocharts.gesture.ZoomType; import lecho.lib.hellocharts.listener.ColumnChartOnValueSelectListener; import lecho.lib.hellocharts.model.Axis; import lecho.lib.hellocharts.model.AxisValue; import lecho.lib.hellocharts.model.Column; import lecho.lib.hellocharts.model.ColumnChartData; import lecho.lib.hellocharts.model.Line; import lecho.lib.hellocharts.model.LineChartData; import lecho.lib.hellocharts.model.PointValue; import lecho.lib.hellocharts.model.SubcolumnValue; import lecho.lib.hellocharts.model.Viewport; import lecho.lib.hellocharts.util.ChartUtils; import lecho.lib.hellocharts.view.ColumnChartView; import lecho.lib.hellocharts.view.LineChartView;

/**

public class ReducedDependencyChart extends Activity implements AdapterView.OnItemSelectedListener {

private LineChartView chartTop;
private ColumnChartView chartBottom;

private LineChartData lineData;
private ColumnChartData columnData;
private List<List<ComputerOuterClass.Computer>> dataList;
protected static ProgressDialog dialog;
private GetChart1 asyncRate = new GetChart1();

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.reduced_dependency_chart);

    dialog = ProgressDialog.show(ReducedDependencyChart.this, "",
            "Loading your chart. Please wait...", true);

    try {
        asyncRate = new GetChart1();
        asyncRate.execute(String.valueOf(((WindowManager)

getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getWidth()), "Avg"); } catch (Exception e) { }

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

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

    // *** BOTTOM COLUMN CHART ***

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

@Override
public void onItemSelected(AdapterView<?> parent, View view, int

position, long id) { // On selecting a spinner item String item = parent.getItemAtPosition(position).toString();

    // Showing selected spinner item
    Toast.makeText(parent.getContext(), "Selected: " + item,

Toast.LENGTH_LONG).show(); //asyncRate = new GetChart1(); //asyncRate.execute(String.valueOf(((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getWidth()), "Avg"); } public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub }

private void generateColumnData() {

    int numSubcolumns = 1;
    // int numColumns = months.length;
    int numColumns = dataList.size();

    List<AxisValue> axisValues = new ArrayList<AxisValue>();
    List<Column> columns = new ArrayList<Column>();
    List<SubcolumnValue> values;
    for (int i = 0; i < numColumns; ++i) {

        values = new ArrayList<SubcolumnValue>();
        for (int j = 0; j < numSubcolumns; ++j) {
            //values.add(new SubcolumnValue((float) Math.random()

2016-11-27 22:53 GMT+02:00 Leszek Wach notifications@github.com:

Hi, could you some code simple?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lecho/hellocharts-android/issues/357#issuecomment-263146816, or mute the thread https://github.com/notifications/unsubscribe-auth/ASUHAQQuabi9o8qCYggP0sCRzHuby1loks5rCe3XgaJpZM4K6AQ3 .