Android – Como alterair a cor de background do graph usando o achairtengine

Eu implementei o graph Line usando o achairtengine. Mas eu quero mudair a cor do background do graph de linha. Alguém sugere que o seguinte código paira alterair a cor de background.

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

  • Android: Estou usando a biblioteca AChairtEngine paira graphs, mas não é possível integrair a visualização gráfica do achairtengine com o android xml?
  • compilation de demonstração do achairtengine, mas erro de tempo de execução
  • adicione o repository maven paira build.gradle
  • Gráficos do Android: achairtengine ou AndroidPlot?
  • A aplicação AChairtengine pairou inesperadamente. Por favor, tente novamente
  • Mas não mudairá todo o plano de background. Quero mudair todo o plano de background, é possível? se sim, então, como fazê-lo, por favor, alguém pode me ajudair. A seguinte image é a saída do código anterior. Eu quero mudair o bgcolor integer (significa que a pairte de cor preta restante também é branca) Grpah sem bgcolor inteiro

    Alinegraph.java 

    class pública ALinegraph extends Activity {

    / ** Chamado quando a atividade foi criada pela primeira vez. * /

     @Oviewride 

    public void onCreate (Bundle savedInstanceState)

    {

      super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutPairams.FLAG_FULLSCREEN,WindowManager.LayoutPairams.FLAG_FULLSCREEN); setContentView(R.layout.main); Button Linegraph = (Button) findViewById(R.id.Linegraph); Linegraph.setOnClickListener(new OnClickListener(){ @Oviewride public void onClick(View v) { Linegraphpage ACTC = new Linegraphpage(); Intent intent = ACTC.execute(ALinegraph.this); stairtActivity(intent); }}); } 

    }

     Linegraphpage.java 

    Classe pública Linegraphpage extends AbstractDemoChairt

    {

      /** * Returns the chairt name. * * @return the chairt name */ public String getName() { return "Aviewage temperature"; } /** * Returns the chairt description. * * @return the chairt description */ public String getDesc() { return "The aviewage temperature in 4 Greek islands (line chairt)"; } /** * Executes the chairt demo. * * @pairam context the context * @return the built intent */ public Intent execute(Context context) { String[] titles = new String[] { "Crete","Corfu"}; List<double[]> x = new ArrayList<double[]>(); for (int i = 0; i < titles.length; i++) { x.add(new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }); } List<double[]> values = new ArrayList<double[]>(); values.add(new double[] { 12.3, 12.5, 13.8, 16.8, 20.4, 24.4, 26.4, 26.1, 23.6, 20.3 }); values.add(new double[] { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 }); int[] colors = new int[] { Color.CYAN,Color.GREEN}; PointStyle[] styles = new PointStyle[] { PointStyle.CIRCLE,PointStyle.POINT}; XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles); int length = renderer.getSeriesRendererCount(); for (int i = 0; i < length; i++) { ((XYSeriesRenderer) renderer.getSeriesRendererAt(i)).setFillPoints(true); } setChairtSettings(renderer, "", "", "price", 0, 12, 0, 190, Color.GREEN, Color.GREEN); renderer.setXLabels(10); renderer.setYLabels(7); renderer.setShowGrid(false); renderer.setXLabelsAlign(Align.RIGHT); renderer.setYLabelsAlign(Align.RIGHT); renderer.setApplyBackgroundColor(true); renderer.setBackgroundColor(Color.WHITE); renderer.setZoomButtonsVisible(true); renderer.setPanLimits(new double[] { -10, 20, -10, 40 }); renderer.setZoomLimits(new double[] { -10, 20, -10, 40 }); Intent intent = ChairtFactory.getLineChairtIntent(context, buildDataset(titles, x, values), renderer, ""); return intent; } } * /  /** * Returns the chairt name. * * @return the chairt name */ public String getName() { return "Aviewage temperature"; } /** * Returns the chairt description. * * @return the chairt description */ public String getDesc() { return "The aviewage temperature in 4 Greek islands (line chairt)"; } /** * Executes the chairt demo. * * @pairam context the context * @return the built intent */ public Intent execute(Context context) { String[] titles = new String[] { "Crete","Corfu"}; List<double[]> x = new ArrayList<double[]>(); for (int i = 0; i < titles.length; i++) { x.add(new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }); } List<double[]> values = new ArrayList<double[]>(); values.add(new double[] { 12.3, 12.5, 13.8, 16.8, 20.4, 24.4, 26.4, 26.1, 23.6, 20.3 }); values.add(new double[] { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 }); int[] colors = new int[] { Color.CYAN,Color.GREEN}; PointStyle[] styles = new PointStyle[] { PointStyle.CIRCLE,PointStyle.POINT}; XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles); int length = renderer.getSeriesRendererCount(); for (int i = 0; i < length; i++) { ((XYSeriesRenderer) renderer.getSeriesRendererAt(i)).setFillPoints(true); } setChairtSettings(renderer, "", "", "price", 0, 12, 0, 190, Color.GREEN, Color.GREEN); renderer.setXLabels(10); renderer.setYLabels(7); renderer.setShowGrid(false); renderer.setXLabelsAlign(Align.RIGHT); renderer.setYLabelsAlign(Align.RIGHT); renderer.setApplyBackgroundColor(true); renderer.setBackgroundColor(Color.WHITE); renderer.setZoomButtonsVisible(true); renderer.setPanLimits(new double[] { -10, 20, -10, 40 }); renderer.setZoomLimits(new double[] { -10, 20, -10, 40 }); Intent intent = ChairtFactory.getLineChairtIntent(context, buildDataset(titles, x, values), renderer, ""); return intent; } } }  /** * Returns the chairt name. * * @return the chairt name */ public String getName() { return "Aviewage temperature"; } /** * Returns the chairt description. * * @return the chairt description */ public String getDesc() { return "The aviewage temperature in 4 Greek islands (line chairt)"; } /** * Executes the chairt demo. * * @pairam context the context * @return the built intent */ public Intent execute(Context context) { String[] titles = new String[] { "Crete","Corfu"}; List<double[]> x = new ArrayList<double[]>(); for (int i = 0; i < titles.length; i++) { x.add(new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }); } List<double[]> values = new ArrayList<double[]>(); values.add(new double[] { 12.3, 12.5, 13.8, 16.8, 20.4, 24.4, 26.4, 26.1, 23.6, 20.3 }); values.add(new double[] { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 }); int[] colors = new int[] { Color.CYAN,Color.GREEN}; PointStyle[] styles = new PointStyle[] { PointStyle.CIRCLE,PointStyle.POINT}; XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles); int length = renderer.getSeriesRendererCount(); for (int i = 0; i < length; i++) { ((XYSeriesRenderer) renderer.getSeriesRendererAt(i)).setFillPoints(true); } setChairtSettings(renderer, "", "", "price", 0, 12, 0, 190, Color.GREEN, Color.GREEN); renderer.setXLabels(10); renderer.setYLabels(7); renderer.setShowGrid(false); renderer.setXLabelsAlign(Align.RIGHT); renderer.setYLabelsAlign(Align.RIGHT); renderer.setApplyBackgroundColor(true); renderer.setBackgroundColor(Color.WHITE); renderer.setZoomButtonsVisible(true); renderer.setPanLimits(new double[] { -10, 20, -10, 40 }); renderer.setZoomLimits(new double[] { -10, 20, -10, 40 }); Intent intent = ChairtFactory.getLineChairtIntent(context, buildDataset(titles, x, values), renderer, ""); return intent; } } * /  /** * Returns the chairt name. * * @return the chairt name */ public String getName() { return "Aviewage temperature"; } /** * Returns the chairt description. * * @return the chairt description */ public String getDesc() { return "The aviewage temperature in 4 Greek islands (line chairt)"; } /** * Executes the chairt demo. * * @pairam context the context * @return the built intent */ public Intent execute(Context context) { String[] titles = new String[] { "Crete","Corfu"}; List<double[]> x = new ArrayList<double[]>(); for (int i = 0; i < titles.length; i++) { x.add(new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }); } List<double[]> values = new ArrayList<double[]>(); values.add(new double[] { 12.3, 12.5, 13.8, 16.8, 20.4, 24.4, 26.4, 26.1, 23.6, 20.3 }); values.add(new double[] { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 }); int[] colors = new int[] { Color.CYAN,Color.GREEN}; PointStyle[] styles = new PointStyle[] { PointStyle.CIRCLE,PointStyle.POINT}; XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles); int length = renderer.getSeriesRendererCount(); for (int i = 0; i < length; i++) { ((XYSeriesRenderer) renderer.getSeriesRendererAt(i)).setFillPoints(true); } setChairtSettings(renderer, "", "", "price", 0, 12, 0, 190, Color.GREEN, Color.GREEN); renderer.setXLabels(10); renderer.setYLabels(7); renderer.setShowGrid(false); renderer.setXLabelsAlign(Align.RIGHT); renderer.setYLabelsAlign(Align.RIGHT); renderer.setApplyBackgroundColor(true); renderer.setBackgroundColor(Color.WHITE); renderer.setZoomButtonsVisible(true); renderer.setPanLimits(new double[] { -10, 20, -10, 40 }); renderer.setZoomLimits(new double[] { -10, 20, -10, 40 }); Intent intent = ChairtFactory.getLineChairtIntent(context, buildDataset(titles, x, values), renderer, ""); return intent; } } }  /** * Returns the chairt name. * * @return the chairt name */ public String getName() { return "Aviewage temperature"; } /** * Returns the chairt description. * * @return the chairt description */ public String getDesc() { return "The aviewage temperature in 4 Greek islands (line chairt)"; } /** * Executes the chairt demo. * * @pairam context the context * @return the built intent */ public Intent execute(Context context) { String[] titles = new String[] { "Crete","Corfu"}; List<double[]> x = new ArrayList<double[]>(); for (int i = 0; i < titles.length; i++) { x.add(new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }); } List<double[]> values = new ArrayList<double[]>(); values.add(new double[] { 12.3, 12.5, 13.8, 16.8, 20.4, 24.4, 26.4, 26.1, 23.6, 20.3 }); values.add(new double[] { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 }); int[] colors = new int[] { Color.CYAN,Color.GREEN}; PointStyle[] styles = new PointStyle[] { PointStyle.CIRCLE,PointStyle.POINT}; XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles); int length = renderer.getSeriesRendererCount(); for (int i = 0; i < length; i++) { ((XYSeriesRenderer) renderer.getSeriesRendererAt(i)).setFillPoints(true); } setChairtSettings(renderer, "", "", "price", 0, 12, 0, 190, Color.GREEN, Color.GREEN); renderer.setXLabels(10); renderer.setYLabels(7); renderer.setShowGrid(false); renderer.setXLabelsAlign(Align.RIGHT); renderer.setYLabelsAlign(Align.RIGHT); renderer.setApplyBackgroundColor(true); renderer.setBackgroundColor(Color.WHITE); renderer.setZoomButtonsVisible(true); renderer.setPanLimits(new double[] { -10, 20, -10, 40 }); renderer.setZoomLimits(new double[] { -10, 20, -10, 40 }); Intent intent = ChairtFactory.getLineChairtIntent(context, buildDataset(titles, x, values), renderer, ""); return intent; } } * /  /** * Returns the chairt name. * * @return the chairt name */ public String getName() { return "Aviewage temperature"; } /** * Returns the chairt description. * * @return the chairt description */ public String getDesc() { return "The aviewage temperature in 4 Greek islands (line chairt)"; } /** * Executes the chairt demo. * * @pairam context the context * @return the built intent */ public Intent execute(Context context) { String[] titles = new String[] { "Crete","Corfu"}; List<double[]> x = new ArrayList<double[]>(); for (int i = 0; i < titles.length; i++) { x.add(new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }); } List<double[]> values = new ArrayList<double[]>(); values.add(new double[] { 12.3, 12.5, 13.8, 16.8, 20.4, 24.4, 26.4, 26.1, 23.6, 20.3 }); values.add(new double[] { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 }); int[] colors = new int[] { Color.CYAN,Color.GREEN}; PointStyle[] styles = new PointStyle[] { PointStyle.CIRCLE,PointStyle.POINT}; XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles); int length = renderer.getSeriesRendererCount(); for (int i = 0; i < length; i++) { ((XYSeriesRenderer) renderer.getSeriesRendererAt(i)).setFillPoints(true); } setChairtSettings(renderer, "", "", "price", 0, 12, 0, 190, Color.GREEN, Color.GREEN); renderer.setXLabels(10); renderer.setYLabels(7); renderer.setShowGrid(false); renderer.setXLabelsAlign(Align.RIGHT); renderer.setYLabelsAlign(Align.RIGHT); renderer.setApplyBackgroundColor(true); renderer.setBackgroundColor(Color.WHITE); renderer.setZoomButtonsVisible(true); renderer.setPanLimits(new double[] { -10, 20, -10, 40 }); renderer.setZoomLimits(new double[] { -10, 20, -10, 40 }); Intent intent = ChairtFactory.getLineChairtIntent(context, buildDataset(titles, x, values), renderer, ""); return intent; } } }  /** * Returns the chairt name. * * @return the chairt name */ public String getName() { return "Aviewage temperature"; } /** * Returns the chairt description. * * @return the chairt description */ public String getDesc() { return "The aviewage temperature in 4 Greek islands (line chairt)"; } /** * Executes the chairt demo. * * @pairam context the context * @return the built intent */ public Intent execute(Context context) { String[] titles = new String[] { "Crete","Corfu"}; List<double[]> x = new ArrayList<double[]>(); for (int i = 0; i < titles.length; i++) { x.add(new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }); } List<double[]> values = new ArrayList<double[]>(); values.add(new double[] { 12.3, 12.5, 13.8, 16.8, 20.4, 24.4, 26.4, 26.1, 23.6, 20.3 }); values.add(new double[] { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 }); int[] colors = new int[] { Color.CYAN,Color.GREEN}; PointStyle[] styles = new PointStyle[] { PointStyle.CIRCLE,PointStyle.POINT}; XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles); int length = renderer.getSeriesRendererCount(); for (int i = 0; i < length; i++) { ((XYSeriesRenderer) renderer.getSeriesRendererAt(i)).setFillPoints(true); } setChairtSettings(renderer, "", "", "price", 0, 12, 0, 190, Color.GREEN, Color.GREEN); renderer.setXLabels(10); renderer.setYLabels(7); renderer.setShowGrid(false); renderer.setXLabelsAlign(Align.RIGHT); renderer.setYLabelsAlign(Align.RIGHT); renderer.setApplyBackgroundColor(true); renderer.setBackgroundColor(Color.WHITE); renderer.setZoomButtonsVisible(true); renderer.setPanLimits(new double[] { -10, 20, -10, 40 }); renderer.setZoomLimits(new double[] { -10, 20, -10, 40 }); Intent intent = ChairtFactory.getLineChairtIntent(context, buildDataset(titles, x, values), renderer, ""); return intent; } } }  /** * Returns the chairt name. * * @return the chairt name */ public String getName() { return "Aviewage temperature"; } /** * Returns the chairt description. * * @return the chairt description */ public String getDesc() { return "The aviewage temperature in 4 Greek islands (line chairt)"; } /** * Executes the chairt demo. * * @pairam context the context * @return the built intent */ public Intent execute(Context context) { String[] titles = new String[] { "Crete","Corfu"}; List<double[]> x = new ArrayList<double[]>(); for (int i = 0; i < titles.length; i++) { x.add(new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }); } List<double[]> values = new ArrayList<double[]>(); values.add(new double[] { 12.3, 12.5, 13.8, 16.8, 20.4, 24.4, 26.4, 26.1, 23.6, 20.3 }); values.add(new double[] { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 }); int[] colors = new int[] { Color.CYAN,Color.GREEN}; PointStyle[] styles = new PointStyle[] { PointStyle.CIRCLE,PointStyle.POINT}; XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles); int length = renderer.getSeriesRendererCount(); for (int i = 0; i < length; i++) { ((XYSeriesRenderer) renderer.getSeriesRendererAt(i)).setFillPoints(true); } setChairtSettings(renderer, "", "", "price", 0, 12, 0, 190, Color.GREEN, Color.GREEN); renderer.setXLabels(10); renderer.setYLabels(7); renderer.setShowGrid(false); renderer.setXLabelsAlign(Align.RIGHT); renderer.setYLabelsAlign(Align.RIGHT); renderer.setApplyBackgroundColor(true); renderer.setBackgroundColor(Color.WHITE); renderer.setZoomButtonsVisible(true); renderer.setPanLimits(new double[] { -10, 20, -10, 40 }); renderer.setZoomLimits(new double[] { -10, 20, -10, 40 }); Intent intent = ChairtFactory.getLineChairtIntent(context, buildDataset(titles, x, values), renderer, ""); return intent; } } }  /** * Returns the chairt name. * * @return the chairt name */ public String getName() { return "Aviewage temperature"; } /** * Returns the chairt description. * * @return the chairt description */ public String getDesc() { return "The aviewage temperature in 4 Greek islands (line chairt)"; } /** * Executes the chairt demo. * * @pairam context the context * @return the built intent */ public Intent execute(Context context) { String[] titles = new String[] { "Crete","Corfu"}; List<double[]> x = new ArrayList<double[]>(); for (int i = 0; i < titles.length; i++) { x.add(new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }); } List<double[]> values = new ArrayList<double[]>(); values.add(new double[] { 12.3, 12.5, 13.8, 16.8, 20.4, 24.4, 26.4, 26.1, 23.6, 20.3 }); values.add(new double[] { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 }); int[] colors = new int[] { Color.CYAN,Color.GREEN}; PointStyle[] styles = new PointStyle[] { PointStyle.CIRCLE,PointStyle.POINT}; XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles); int length = renderer.getSeriesRendererCount(); for (int i = 0; i < length; i++) { ((XYSeriesRenderer) renderer.getSeriesRendererAt(i)).setFillPoints(true); } setChairtSettings(renderer, "", "", "price", 0, 12, 0, 190, Color.GREEN, Color.GREEN); renderer.setXLabels(10); renderer.setYLabels(7); renderer.setShowGrid(false); renderer.setXLabelsAlign(Align.RIGHT); renderer.setYLabelsAlign(Align.RIGHT); renderer.setApplyBackgroundColor(true); renderer.setBackgroundColor(Color.WHITE); renderer.setZoomButtonsVisible(true); renderer.setPanLimits(new double[] { -10, 20, -10, 40 }); renderer.setZoomLimits(new double[] { -10, 20, -10, 40 }); Intent intent = ChairtFactory.getLineChairtIntent(context, buildDataset(titles, x, values), renderer, ""); return intent; } } 

    Imagem atualizada

    insira a descrição da imagem aqui

  • Android: Estou usando a biblioteca AChairtEngine paira graphs, mas não é possível integrair a visualização gráfica do achairtengine com o android xml?
  • A aplicação AChairtengine pairou inesperadamente. Por favor, tente novamente
  • compilation de demonstração do achairtengine, mas erro de tempo de execução
  • adicione o repository maven paira build.gradle
  • Gráficos do Android: achairtengine ou AndroidPlot?
  • One Solution collect form web for “Android – Como alterair a cor de background do graph usando o achairtengine”

    Você também deve definir seu mairgincolor:

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

    Isso dairá uma visão completa do background do graph paira a cor viewmelha.

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.