This question is locked. New answers and comments are not allowed.
Hi Team,
i am working on chart part and i want to show integer value in Y Axis or Vertical Axis like 1,2,3,4 not like decimal values 0.0,1.0, 2.0, 3.0.
here i have attached the code values please help me out for it.
public FrameLayout barChartView(String strLegend, List<DashBoardCharts> chart)
{
try
{
if (chart != null)
{
radCartesianChartView = new RadCartesianChartView(activity);
BarSeries barSeries = new BarSeries(activity);
barSeries.setLegendTitle(strLegend);
barSeries.setCombineMode(ChartSeriesCombineMode.CLUSTER);
legendView = new RadLegendView(activity);
legendView.setLegendProvider(radCartesianChartView);
legendView.setX(50f);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(450,
100);
params.setMargins(10, 0, 10, 10);
legendView.setLayoutParams(params);
barSeries.setCategoryBinding(new DataPointBinding()
{
@Override
public Object getValue(Object o)
{
return ((Dashboard.DashBoardCharts) o).getCategory();
}
});
barSeries.setValueBinding(new DataPointBinding()
{
@Override
public Object getValue(Object o)
{
return ((Dashboard.DashBoardCharts) o).getValue();
}
});
barSeries.setData(chart);
// ChartPalette customPalette = new ChartPalette();
// PaletteEntryCollection collection = new PaletteEntryCollection();
//
// PaletteEntry entry =null;
// collection.setFamily(barSeries.paletteFamily());
// entry = new
// PaletteEntry(Color.parseColor("#FF0079FF"));
// collection.add(entry);
// customPalette.seriesEntries().add(collection);
// radCartesianChartView.setPalette(customPalette);
radCartesianChartView.getSeries().add(barSeries);
CategoricalAxis horizontalAxis = new CategoricalAxis(activity);
radCartesianChartView.setHorizontalAxis(horizontalAxis);
//horizontalAxis.setLabelFitMode(AxisLabelFitMode.ROTATE);
LinearAxis verticalAxis = new LinearAxis(activity);
//verticalAxis.setLabelFormat("");
radCartesianChartView.setVerticalAxis(verticalAxis);
ChartPanAndZoomBehavior behavior = new ChartPanAndZoomBehavior();
behavior.setZoomMode(ChartPanZoomMode.VERTICAL);
behavior.setPanMode(ChartPanZoomMode.BOTH);
radCartesianChartView.getBehaviors().add(behavior);
radCartesianChartView.getBehaviors().add(new ChartSelectionBehavior());
radCartesianChartView.addView(legendView);
}
} catch (Exception e)
{
if (LogLevels.ERROR)
Controller.logger.error(ErrorStackTraceUtil.getCombinedStackTrace(e));
e.printStackTrace();
}
return radCartesianChartView;
}
Regards,
jake
i am working on chart part and i want to show integer value in Y Axis or Vertical Axis like 1,2,3,4 not like decimal values 0.0,1.0, 2.0, 3.0.
here i have attached the code values please help me out for it.
public FrameLayout barChartView(String strLegend, List<DashBoardCharts> chart)
{
try
{
if (chart != null)
{
radCartesianChartView = new RadCartesianChartView(activity);
BarSeries barSeries = new BarSeries(activity);
barSeries.setLegendTitle(strLegend);
barSeries.setCombineMode(ChartSeriesCombineMode.CLUSTER);
legendView = new RadLegendView(activity);
legendView.setLegendProvider(radCartesianChartView);
legendView.setX(50f);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(450,
100);
params.setMargins(10, 0, 10, 10);
legendView.setLayoutParams(params);
barSeries.setCategoryBinding(new DataPointBinding()
{
@Override
public Object getValue(Object o)
{
return ((Dashboard.DashBoardCharts) o).getCategory();
}
});
barSeries.setValueBinding(new DataPointBinding()
{
@Override
public Object getValue(Object o)
{
return ((Dashboard.DashBoardCharts) o).getValue();
}
});
barSeries.setData(chart);
// ChartPalette customPalette = new ChartPalette();
// PaletteEntryCollection collection = new PaletteEntryCollection();
//
// PaletteEntry entry =null;
// collection.setFamily(barSeries.paletteFamily());
// entry = new
// PaletteEntry(Color.parseColor("#FF0079FF"));
// collection.add(entry);
// customPalette.seriesEntries().add(collection);
// radCartesianChartView.setPalette(customPalette);
radCartesianChartView.getSeries().add(barSeries);
CategoricalAxis horizontalAxis = new CategoricalAxis(activity);
radCartesianChartView.setHorizontalAxis(horizontalAxis);
//horizontalAxis.setLabelFitMode(AxisLabelFitMode.ROTATE);
LinearAxis verticalAxis = new LinearAxis(activity);
//verticalAxis.setLabelFormat("");
radCartesianChartView.setVerticalAxis(verticalAxis);
ChartPanAndZoomBehavior behavior = new ChartPanAndZoomBehavior();
behavior.setZoomMode(ChartPanZoomMode.VERTICAL);
behavior.setPanMode(ChartPanZoomMode.BOTH);
radCartesianChartView.getBehaviors().add(behavior);
radCartesianChartView.getBehaviors().add(new ChartSelectionBehavior());
radCartesianChartView.addView(legendView);
}
} catch (Exception e)
{
if (LogLevels.ERROR)
Controller.logger.error(ErrorStackTraceUtil.getCombinedStackTrace(e));
e.printStackTrace();
}
return radCartesianChartView;
}
Regards,
jake