private void pFill(cWebChart chart, DataRowCollection rows, String strFormat)
{
int i = 0;
t_SerieValue[] values = null;
cReportChartSerie serie = null;
int idxSerie = 0;
if (m_top == 0) { m_top = 50; }
// TODO: we need the rows dimension. remeber rows is a matrix (cols by rows)
if (rows.Count < 0) { return; }
// TODO: we need the rows dimension. remeber rows is a matrix (cols by rows)
if (rows.Count < m_top) {
// TODO: we need the rows dimension. remeber rows is a matrix (cols by rows)
pRedim(ref values, rows.Count);
}
else {
pRedim(ref values, m_top - 1);
}
for (int _i = 0; _i < m_series.count(); _i++) {
serie = m_series.item(_i);
// At the time we only support two series
//
idxSerie = idxSerie + 1;
if (idxSerie > 2) { return; }
pGetSerieValues(rows,
values,
serie.getValueIndex(),
serie.getLabelIndex(),
m_chartType == csRptChartType.PIE);
for (i = 0; i < values.Length; i++) {
if (values[i].idx != -1) {
if (idxSerie == 1) {
cWebChartItem w_add = chart.getItems().add(null);
w_add.setPrimaryValue(values[i].value);
w_add.setPrimaryLabel(cReportGlobals.format(values[i].label, strFormat));
w_add.setPieLabel(cReportGlobals.format(values[i].label, strFormat));
w_add.setAlternateValue(0);
}
else if (idxSerie == 2) {
cWebChartItem w_item = chart.getItems().item(i);
w_item.setAlternateValue(values[i].value);
w_item.setPieLabel(cReportGlobals.format(values[i].label, strFormat));
w_item.setAltLabel(cReportGlobals.format(values[i].label, strFormat));
}
}
}
if ((values.Length > m_top - 1) && m_chartType == csRptChartType.PIE) {
cWebChartItem w_item = chart.getItems().item(chart.getItems().count()-1);
w_item.setPrimaryLabel("Otros");
w_item.setPieLabel("Otros");
}
}
if (chart.getItems().count() > 0) {
chart.getItems().item(0).setExplode(true);
}
}