// Path: app/src/main/java/com/jjoe64/graphview_demos/FullscreenActivity.java
// public class FullscreenActivity extends AppCompatActivity {
//     private BaseExample mLogic;
// 
//     @Override
//     public void onCreate(@Nullable Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
// 
//         String name = getIntent().getStringExtra(FullscreenExample.ARG_ID);
//         FullscreenExample example = FullscreenExample.valueOf(name);
// 
//         setContentView(example.contentView);
//         try {
//             mLogic = example.exampleClass.newInstance();
//             mLogic.onCreate(this);
//         } catch (InstantiationException e) {
//             e.printStackTrace();
//         } catch (IllegalAccessException e) {
//             e.printStackTrace();
//         }
//     }
// 
//     @Override
//     protected void onResume() {
//         super.onResume();
//         mLogic.onResume();
//     }
// 
//     @Override
//     protected void onPause() {
//         mLogic.onPause();
//         super.onPause();
//     }
// 
//     @Override
//     public void onRequestPermissionsResult(int requestCode,
//                                            String permissions[], int[] grantResults) {
//         switch (requestCode) {
//             case SnapshotShareGraph.REQUEST_CODE_PERMISSION: {
//                 // If request is cancelled, the result arrays are empty.
//                 if (grantResults.length > 0
//                         && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// 
//                     SnapshotShareGraph example = (SnapshotShareGraph) mLogic;
//                     example.snapshot();
// 
//                 } else {
//                     Toast.makeText(this, "Permission denied. Not possible to show example.", Toast.LENGTH_SHORT).show();
//                 }
//                 return;
//             }
//         }
//     }
// 
// }


import android.graphics.Color;
import android.graphics.DashPathEffect;
import android.graphics.Paint;
import com.jjoe64.graphview.GraphView;
import com.jjoe64.graphview.GridLabelRenderer;
import com.jjoe64.graphview.series.DataPoint;
import com.jjoe64.graphview.series.LineGraphSeries;
import com.jjoe64.graphview_demos.FullscreenActivity;
import com.jjoe64.graphview_demos.R;
package com.jjoe64.graphview_demos.examples;



/**
 * Created by jonas on 10.09.16.
 */
public class StylingColors extends BaseExample {
    @Override
    public void onCreate(FullscreenActivity activity) {
        GraphView graph = (GraphView) activity.findViewById(R.id.graph);
        initGraph(graph);
    }

    @Override
    public void initGraph(GraphView graph) {
        DataPoint[] points = new DataPoint[30];
        for (int i = 0; i < 30; i++) {
            points[i] = new DataPoint(i, Math.sin(i*0.5) * 20*(Math.random()*10+1));
        }
        LineGraphSeries<DataPoint> series = new LineGraphSeries<>(points);

        points = new DataPoint[15];
        for (int i = 0; i < 15; i++) {
            points[i] = new DataPoint(i*2, Math.sin(i*0.5) * 20*(Math.random()*10+1));
        }
        LineGraphSeries<DataPoint> series2 = new LineGraphSeries<>(points);

        // styling grid/labels
        graph.getGridLabelRenderer().setGridColor(Color.RED);
        graph.getGridLabelRenderer().setHighlightZeroLines(false);
        graph.getGridLabelRenderer().setHorizontalLabelsColor(Color.GREEN);
        graph.getGridLabelRenderer().setVerticalLabelsColor(Color.RED);
        graph.getGridLabelRenderer().setVerticalLabelsVAlign(GridLabelRenderer.VerticalLabelsVAlign.ABOVE);
        graph.getGridLabelRenderer().setGridStyle(GridLabelRenderer.GridStyle.HORIZONTAL);
        graph.getGridLabelRenderer().reloadStyles();


        // styling viewport
        graph.getViewport().setBackgroundColor(Color.argb(255, 222, 222, 222));
        graph.getViewport().setDrawBorder(true);
        graph.getViewport().setBorderColor(Color.BLUE);

        // styling series
// Path: app/src/main/java/com/jjoe64/graphview_demos/FullscreenActivity.java
// public class FullscreenActivity extends AppCompatActivity {
//     private BaseExample mLogic;
// 
//     @Override
//     public void onCreate(@Nullable Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
// 
//         String name = getIntent().getStringExtra(FullscreenExample.ARG_ID);
//         FullscreenExample example = FullscreenExample.valueOf(name);
// 
//         setContentView(example.contentView);
//         try {
//             mLogic = example.exampleClass.newInstance();
//             mLogic.onCreate(this);
//         } catch (InstantiationException e) {
//             e.printStackTrace();
//         } catch (IllegalAccessException e) {
//             e.printStackTrace();
//         }
//     }
// 
//     @Override
//     protected void onResume() {
//         super.onResume();
//         mLogic.onResume();
//     }
// 
//     @Override
//     protected void onPause() {
//         mLogic.onPause();
//         super.onPause();
//     }
// 
//     @Override
//     public void onRequestPermissionsResult(int requestCode,
//                                            String permissions[], int[] grantResults) {
//         switch (requestCode) {
//             case SnapshotShareGraph.REQUEST_CODE_PERMISSION: {
//                 // If request is cancelled, the result arrays are empty.
//                 if (grantResults.length > 0
//                         && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// 
//                     SnapshotShareGraph example = (SnapshotShareGraph) mLogic;
//                     example.snapshot();
// 
//                 } else {
//                     Toast.makeText(this, "Permission denied. Not possible to show example.", Toast.LENGTH_SHORT).show();
//                 }
//                 return;
//             }
//         }
//     }
// 
// }


// Path: app/src/main/java/com/jjoe64/graphview_demos/examples/StylingColors.java
import android.graphics.Color;
import android.graphics.DashPathEffect;
import android.graphics.Paint;
import com.jjoe64.graphview.GraphView;
import com.jjoe64.graphview.GridLabelRenderer;
import com.jjoe64.graphview.series.DataPoint;
import com.jjoe64.graphview.series.LineGraphSeries;
import com.jjoe64.graphview_demos.FullscreenActivity;
import com.jjoe64.graphview_demos.R;

package com.jjoe64.graphview_demos.examples;



/**
 * Created by jonas on 10.09.16.
 */
public class StylingColors extends BaseExample {
    @Override
    public void onCreate(FullscreenActivity activity) {
        GraphView graph = (GraphView) activity.findViewById(R.id.graph);
        initGraph(graph);
    }

    @Override
    public void initGraph(GraphView graph) {
        DataPoint[] points = new DataPoint[30];
        for (int i = 0; i < 30; i++) {
            points[i] = new DataPoint(i, Math.sin(i*0.5) * 20*(Math.random()*10+1));
        }
        LineGraphSeries<DataPoint> series = new LineGraphSeries<>(points);

        points = new DataPoint[15];
        for (int i = 0; i < 15; i++) {
            points[i] = new DataPoint(i*2, Math.sin(i*0.5) * 20*(Math.random()*10+1));
        }
        LineGraphSeries<DataPoint> series2 = new LineGraphSeries<>(points);

        // styling grid/labels
        graph.getGridLabelRenderer().setGridColor(Color.RED);
        graph.getGridLabelRenderer().setHighlightZeroLines(false);
        graph.getGridLabelRenderer().setHorizontalLabelsColor(Color.GREEN);
        graph.getGridLabelRenderer().setVerticalLabelsColor(Color.RED);
        graph.getGridLabelRenderer().setVerticalLabelsVAlign(GridLabelRenderer.VerticalLabelsVAlign.ABOVE);
        graph.getGridLabelRenderer().setGridStyle(GridLabelRenderer.GridStyle.HORIZONTAL);
        graph.getGridLabelRenderer().reloadStyles();


        // styling viewport
        graph.getViewport().setBackgroundColor(Color.argb(255, 222, 222, 222));
        graph.getViewport().setDrawBorder(true);
        graph.getViewport().setBorderColor(Color.BLUE);

        // styling series
        series.setTitle("Random Curve 1");