AChartEngine Configuration Part1


How to set value in x axis label in achartengine

for (int i = 0; i < titles.length; i++) 
    {
      x.add(new double[] { 1, 2});
       }

String[] date={"6-6-2012","10-OCT-2012","1-November-2012","umitems"}; 
for (int i = 0; i < date.length; i++) 
    { 
    renderer.addTextLabel(i+1, date[i]);
    }
    renderer.setXLabelsAlign(Align.CENTER);
    renderer.setXLabels(0);
http://stackoverflow.com/questions/16843579/how-to-use-custom-x-axis-label-and-y-axis-label-in-achartengine
http://stackoverflow.com/questions/9904457/how-to-set-value-in-x-axis-label-in-achartengine
http://stackoverflow.com/questions/15076674/achartengine-y-axis-custom-labels-area-margins-and-chart-values-as-string

Custom zoom buttons

renderer.setZoomEnabled(true);
renderer.setExternalZoomEnabled(true);
renderer.setApplyBackgroundColor(true);

<Button
                    android:id="@+id/zoomin"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom"
                    android:background="@drawable/action_zoomin"
                    android:hapticFeedbackEnabled="true"
                    android:layout_marginRight="15dp">
  </Button>



private XYMultipleSeriesRenderer mRenderer; //or any of other renderer
mRenderer.setZoomButtonsVisible(false);
mRenderer.setExternalZoomEnabled(true);

//then add click events tot he imagebuttons on the view
//mChartView --> private GraphicalView mChartView;

    ImageButton btnZoomIn= (ImageButton) findViewById(R.id.btnZoomIn);

    btnZoomIn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mChartView.zoomIn();

            }
    });

    ImageButton  btnZoomOut = (ImageButton) findViewById(R.id.btnZoomOut );

    btnZoomOut.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mChartView.zoomOut();
            }
    });

http://stackoverflow.com/questions/9142212/achartengine-custom-zoom-buttons


Change BgColor

mRenderer.setApplyBackgroundColor(true);
mRenderer.setBackgroundColor(Color.RED);
mRenderer.setMarginsColor(Color.RED);

http://stackoverflow.com/questions/7711586/android-how-to-change-the-background-color-of-the-graph-using-achartengine

Transparent BgColor
setMarginsColor(Color.argb(0x00, 0x01, 0x01, 0x01));
It looks like there's a bug when setting the color as black transparent

http://stackoverflow.com/questions/9314342/achartengine-transparent-background

Set line thickness for a graph
int length = renderer.getSeriesRendererCount();
        for (int i = 0; i < length; i++) {
            XYSeriesRenderer seriesRenderer = (XYSeriesRenderer) renderer
                    .getSeriesRendererAt(i);                
            seriesRenderer.setLineWidth(2f);

        }
http://stackoverflow.com/questions/4678324/setting-line-thickness-for-a-graph-achart-engine




Popular posts from this blog

เทคนิค ชนะ เกมเศรษฐี 14 ตารวด!!! ( Let's get Rich )

Using Google Chrome Inspect Element to Analyze the website

Easy way to download whole youtube play list and convert them to mp3