Search in sources :

Example 1 with DialChart

use of org.achartengine.chart.DialChart in project Anki-Android by Ramblurr.

the class ChartFactory method getDialChartView.

/**
   * Creates a dial chart intent that can be used to start the graphical view
   * activity.
   * 
   * @param context the context
   * @param dataset the category series dataset (cannot be null)
   * @param renderer the dial renderer (cannot be null)
   * @return a pie chart view
   * @throws IllegalArgumentException if dataset is null or renderer is null or
   *           if the dataset number of items is different than the number of
   *           series renderers
   */
public static final GraphicalView getDialChartView(Context context, CategorySeries dataset, DialRenderer renderer) {
    checkParameters(dataset, renderer);
    DialChart chart = new DialChart(dataset, renderer);
    return new GraphicalView(context, chart);
}
Also used : DialChart(org.achartengine.chart.DialChart)

Example 2 with DialChart

use of org.achartengine.chart.DialChart in project sensorreadout by onyxbits.

the class ChartFactory method getDialChartIntent.

/**
   * Creates a dial chart intent that can be used to start the graphical view
   * activity.
   * 
   * @param context the context
   * @param dataset the category series dataset (cannot be null)
   * @param renderer the dial renderer (cannot be null)
   * @param activityTitle the graphical chart activity title
   * @return a dial chart intent
   * @throws IllegalArgumentException if dataset is null or renderer is null or
   *           if the dataset number of items is different than the number of
   *           series renderers
   */
public static final Intent getDialChartIntent(Context context, CategorySeries dataset, DialRenderer renderer, String activityTitle) {
    checkParameters(dataset, renderer);
    Intent intent = new Intent(context, GraphicalActivity.class);
    DialChart chart = new DialChart(dataset, renderer);
    intent.putExtra(CHART, chart);
    intent.putExtra(TITLE, activityTitle);
    return intent;
}
Also used : Intent(android.content.Intent) DialChart(org.achartengine.chart.DialChart)

Example 3 with DialChart

use of org.achartengine.chart.DialChart in project sensorreadout by onyxbits.

the class ChartFactory method getDialChartView.

/**
   * Creates a dial chart view that can be used to start the graphical view
   * activity.
   * 
   * @param context the context
   * @param dataset the category series dataset (cannot be null)
   * @param renderer the dial renderer (cannot be null)
   * @return a pie chart view
   * @throws IllegalArgumentException if dataset is null or renderer is null or
   *           if the dataset number of items is different than the number of
   *           series renderers
   */
public static final GraphicalView getDialChartView(Context context, CategorySeries dataset, DialRenderer renderer) {
    checkParameters(dataset, renderer);
    DialChart chart = new DialChart(dataset, renderer);
    return new GraphicalView(context, chart);
}
Also used : DialChart(org.achartengine.chart.DialChart)

Example 4 with DialChart

use of org.achartengine.chart.DialChart in project Anki-Android by Ramblurr.

the class ChartFactory method getDialChartIntent.

/**
   * Creates a dial chart intent that can be used to start the graphical view
   * activity.
   * 
   * @param context the context
   * @param dataset the category series dataset (cannot be null)
   * @param renderer the dial renderer (cannot be null)
   * @param activityTitle the graphical chart activity title
   * @return a dial chart intent
   * @throws IllegalArgumentException if dataset is null or renderer is null or
   *           if the dataset number of items is different than the number of
   *           series renderers
   */
public static final Intent getDialChartIntent(Context context, CategorySeries dataset, DialRenderer renderer, String activityTitle) {
    checkParameters(dataset, renderer);
    Intent intent = new Intent(context, GraphicalActivity.class);
    DialChart chart = new DialChart(dataset, renderer);
    intent.putExtra(CHART, chart);
    intent.putExtra(TITLE, activityTitle);
    return intent;
}
Also used : Intent(android.content.Intent) DialChart(org.achartengine.chart.DialChart)

Example 5 with DialChart

use of org.achartengine.chart.DialChart in project AndrOBD by fr3ts0n.

the class ObdGaugeAdapter method getView.

/* (non-Javadoc)
	 * @see android.widget.ArrayAdapter#getView(int, android.view.View, android.view.ViewGroup)
	 */
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    EcuDataPv currPv = getItem(position);
    int pid = currPv.getAsInt(EcuDataPv.FID_PID);
    // if no recycled convertView delivered, then create a new one
    if (convertView == null) {
        convertView = mInflater.inflate(resourceId, parent, false);
        holder = new ViewHolder();
        // get all views into view holder
        holder.gauge = (FrameLayout) convertView.findViewById(R.id.gauge);
        holder.tvDescr = (TextView) convertView.findViewById(R.id.label);
        // remember this view holder
        convertView.setTag(holder);
    } else {
        // recall previous holder
        holder = (ViewHolder) convertView.getTag();
    }
    convertView.getLayoutParams().width = minWidth;
    convertView.getLayoutParams().height = minHeight;
    // if no rendering component is registered with PV, then create and register new one
    DialChart chartView = (DialChart) currPv.getRenderingComponent();
    if (chartView == null) {
        CategorySeries category = (CategorySeries) currPv.get(FID_GAUGE_SERIES);
        Number minValue = (Number) currPv.get(EcuDataPv.FID_MIN);
        Number maxValue = (Number) currPv.get(EcuDataPv.FID_MAX);
        if (minValue == null)
            minValue = 0f;
        if (maxValue == null)
            maxValue = 255f;
        DialRenderer renderer = new DialRenderer();
        renderer.setScale(1.25f);
        // dial background
        renderer.setPanEnabled(false);
        renderer.setShowLegend(false);
        renderer.setShowLabels(true);
        renderer.setLabelsTextSize(mDisplayMetrics.densityDpi / 10);
        renderer.setLabelsColor(Color.WHITE);
        renderer.setShowLabels(true);
        renderer.setVisualTypes(new DialRenderer.Type[] { DialRenderer.Type.NEEDLE });
        renderer.setMinValue(minValue.doubleValue());
        renderer.setMaxValue(maxValue.doubleValue());
        renderer.setChartTitle(currPv.getUnits());
        renderer.setChartTitleTextSize(mDisplayMetrics.densityDpi / 10);
        SimpleSeriesRenderer r = new SimpleSeriesRenderer();
        r.setColor(ChartActivity.getItemColor(pid));
        try {
            r.setChartValuesFormat(labelFormat);
        } catch (Exception e) {
        // ignore
        }
        renderer.addSeriesRenderer(0, r);
        // create chart view and register with PV
        chartView = new DialChart(category, renderer);
        currPv.setRenderingComponent(chartView);
    }
    convertView.setBackgroundColor(ChartActivity.getItemColor(pid) & 0x08FFFFFF);
    // set new values for display
    holder.tvDescr.setTextColor(ChartActivity.getItemColor(pid));
    holder.tvDescr.setText(String.valueOf(currPv.get(EcuDataPv.FID_DESCRIPT)));
    // replace DialChart if needed
    holder.gauge.removeViewAt(0);
    holder.gauge.addView(new GraphicalView(getContext(), chartView), 0);
    return convertView;
}
Also used : EcuDataPv(com.fr3ts0n.ecu.EcuDataPv) SimpleSeriesRenderer(org.achartengine.renderer.SimpleSeriesRenderer) GraphicalView(org.achartengine.GraphicalView) CategorySeries(org.achartengine.model.CategorySeries) DialRenderer(org.achartengine.renderer.DialRenderer) DialChart(org.achartengine.chart.DialChart)

Aggregations

DialChart (org.achartengine.chart.DialChart)5 Intent (android.content.Intent)2 EcuDataPv (com.fr3ts0n.ecu.EcuDataPv)1 GraphicalView (org.achartengine.GraphicalView)1 CategorySeries (org.achartengine.model.CategorySeries)1 DialRenderer (org.achartengine.renderer.DialRenderer)1 SimpleSeriesRenderer (org.achartengine.renderer.SimpleSeriesRenderer)1