java - loading graph chart in a layout -


i try load graphic in layout, mathematical graphic using achartengine. downloaded demo zip site , realized need sin-cosin grahp style. so, code wrote:

    package com.myproject;     import org.achartengine.chartfactory;     import org.achartengine.graphicalview;     import org.achartengine.chart.pointstyle;     import org.achartengine.model.xymultipleseriesdataset;     import org.achartengine.renderer.xymultipleseriesrenderer;     import android.os.bundle;     import android.app.activity;     import android.content.intent;     import android.graphics.color;     import android.view.view;     import android.webkit.webview;     import android.widget.linearlayout;     import android.widget.linearlayout.layoutparams;     import com.myproject.clases.abstractdemochart;      public class mainactivity extends activity {  private webview ventana; private graphicalview mchartview;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      xymultipleseriesdataset mdataset = null;//this line causes runtime error see issue later.             int [] colors = new int[] { color.blue, color.cyan };         pointstyle[] styles = new pointstyle[] { pointstyle.point, pointstyle.point };         xymultipleseriesrenderer mrenderer = buildrenderer(colors, styles);     linearlayout layout = (linearlayout) findviewbyid(r.id.chart);           mchartview = chartfactory.getlinechartview(this, mdataset, mrenderer);     layout.addview(mchartview, new layoutparams(layoutparams.fill_parent, layoutparams.fill_parent)); } } 

but line

    xymultipleseriesrenderer mrenderer = buildrenderer(colors, styles); 

is causing compilation error due method buildrenderer() belongs abstractdemochart class. how can take method class used in one? maybe basic question of object programming know, i'am asking in here know if doing in intention load grahp chart in layout. i'm working in eclipse. thanks

buildrenderer protected method in abstractdemochart. in achartexampleactivity sample buildrenderer private method this:

private xymultipleseriesrenderer buildrenderer(int[] colors,pointstyle[] styles)      {         xymultipleseriesrenderer renderer = new xymultipleseriesrenderer();         setrenderer(renderer, colors, styles);         return renderer;     } 

have seen generatedchartdemo code? creates renderer way:

private xymultipleseriesrenderer getdemorenderer() {      xymultipleseriesrenderer renderer = new xymultipleseriesrenderer();     renderer.setaxistitletextsize(16);     renderer.setcharttitletextsize(20);     renderer.setlabelstextsize(15);     renderer.setlegendtextsize(15);     renderer.setpointsize(5f);     renderer.setmargins(new int[] {20, 30, 15, 0});      ... 

i think should change way you're initializing xymultipleseriesrenderer.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -