Programación y Desarrollo para Android Subforo exclusivo para temas de programación de software para PDAs y desarrollo de aplicaciones, interfaces, etc bajo Android

Respuesta
 
Herramientas
  #1  
Viejo 27/02/15, 00:13:18
Array

[xs_avatar]
LEAJIM_454 LEAJIM_454 no está en línea
Miembro del foro
 
Fecha de registro: nov 2012
Mensajes: 215
Modelo de smartphone: Galaxy Ace
Tu operador: Otra
Ayuda con error en libreria GraphView ejecutando en eclipse

Muy buenas, encontré una libreria pero el problema que tengo es que esta diseñado para AndroidStudio y yo uso Eclipse por que AS es demasiado pesado para mi PC, intente adaptarlo y hay una clase que me da problemas, mi duda es saber si existe alguna solucion, gracias por leer y gracias de antemano por la ayuda.

Esta es la clase

[PHP]/**
* GraphView
* Copyright (C) 2014 Jonas Gehring
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License,
* with the "Linking Exception", which can be found at the license.txt
* file in this program.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* with the "Linking Exception" along with this program; if not,
* write to the author Jonas Gehring <[email protected]>.
*
package com.jjoe64.graphview.helper;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.util.AttributeSet;
import android.util.Log;

import com.jjoe64.graphview.GraphView;
import com.jjoe64.graphview.R;
import com.jjoe64.graphview.series.BarGraphSeries;
import com.jjoe64.graphview.series.BaseSeries;
import com.jjoe64.graphview.series.DataPoint;
import com.jjoe64.graphview.series.DataPointInterface;
import com.jjoe64.graphview.series.LineGraphSeries;
import com.jjoe64.graphview.series.PointsGraphSeries;
import com.jjoe64.graphview.series.Series;

/**
* helper class to use GraphView directly
* in a XML layout file.
*
* You can set the data via attribute <b>app:seriesData</b>
* in the format: "X=Y;X=Y;..." e.g. "0=5.0;1=5;2=4;3=9"
*
* Other styling options:
* <li>app:seriesType="line|bar|points"</li>
* <li>app:seriesColor="#ff0000"</li>
* <li>app:seriesTitle="foobar" - if this is set, the legend will be drawn</li>
* <li>android:title="foobar"</li>
*
* Example:
* <pre>
* {@code
* <com.jjoe64.graphview.helper.GraphViewXML
* android:layout_width="match_parent"
* android:layout_height="100dip"
* app:seriesData="0=5;2=5;3=0;4=2"
* app:seriesType="line"
* app:seriesColor="#ee0000" />
* }
* </pre>
*
* @author jjoe64
*
public class GraphViewXML extends GraphView {
/**
* creates the graphview object with data and
* other options from xml attributes.
*
* @param context
* @param attrs
*
public GraphViewXML(Context context, AttributeSet attrs) {
super(context, attrs);

// get attributes
TypedArray a=context.obtainStyledAttributes(
attrs,
com.jjoe64.graphview.helper.GraphViewXML);
String dataStr = a.getString(R.styleable.GraphViewXML_seriesData);
int color = a.getColor(R.styleable.GraphViewXML_seriesColor, Color.TRANSPARENT);
String type = a.getString(R.styleable.GraphViewXML_seriesType);
String seriesTitle = a.getString(R.styleable.GraphViewXML_seriesTitle);
String title = a.getString(R.styleable.GraphViewXML_android_title );

a.recycle();

// decode data
DataPoint[] data;
if (dataStr == null || dataStr.isEmpty()) {
throw new IllegalArgumentException("Attribute seriesData is required in the format: 0=5.0;1=5;2=4;3=9");
} else {
String[] d = dataStr.split(";");
try {
data = new DataPoint[d.length];
int i = 0;
for (String dd : d) {
String[] xy = dd.split("=");
data[i] = new DataPoint(Double.parseDouble(xy[0]), Double.parseDouble(xy[1]));
i++;
}
} catch (Exception e) {
Log.d("GraphViewXML", e.toString());
throw new IllegalArgumentException("Attribute seriesData is broken. Use this format: 0=5.0;1=5;2=4;3=9");
}
}

// create series
BaseSeries<DataPoint> series;
if (type == null || type.isEmpty()) {
type = "line";
}
if (type.equals("line")) {
series = new LineGraphSeries<DataPoint>(data);
} else if (type.equals("bar")) {
series = new BarGraphSeries<DataPoint>(data);
} else if (type.equals("points")) {
series = new PointsGraphSeries<DataPoint>(data);
} else {
throw new IllegalArgumentException("unknown graph type: "+type+". Possible is line|bar|points");
}
if (color != Color.TRANSPARENT) {
series.setColor(color);
}
addSeries(series);

if (seriesTitle != null && !seriesTitle.isEmpty()) {
series.setTitle(seriesTitle);
getLegendRenderer().setVisible(true);
}

if (title != null && !title.isEmpty()) {
setTitle(title);
}
}
}
[/PHP]
Responder Con Cita


  #2  
Viejo 27/02/15, 00:14:32
Array

[xs_avatar]
LEAJIM_454 LEAJIM_454 no está en línea
Miembro del foro
 
Fecha de registro: nov 2012
Mensajes: 215
Modelo de smartphone: Galaxy Ace
Tu operador: Otra
Lo siento, me olvidaba el problema recide en la linea 72 justo donde dice

[PHP] com.jjoe64.graphview.helper.GraphViewXML);[/PHP]
Responder Con Cita
Respuesta

Estás aquí
Regresar   Portal | Indice > Todo sobre Android > Programación y Desarrollo para Android



Hora actual: 10:51:41 (GMT +2)



User Alert System provided by Advanced User Tagging (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.

Contactar por correo / Contact by mail / 邮件联系 /