How can I print KPI graphic ?
See the attached kpi.png, I ́m using [Preço Venda] - [Valor Venda NF] "expression editor" and I cannot change this expression or it will not match the result (see my code below). But when I print it the graphic doesn ́t appear, I think that I will need change the column value to (1, -1 or 0) in printing preview runtime, but how can I do it ?
Attached is a small sample too, but in this case it ́s not working any graphic.
private void pivotGridControl_CustomDrawCell(object sender, PivotCustomDrawCellEventArgs e)
if (e.DataField.UnboundType == UnboundColumnType.Object)
Bitmap bitmap = null;
int valorIndicador = 0;
// Seta valor indicador
if (Convert.ToInt32(e.Value) < 0)
valorIndicador = -1;
if (Convert.ToInt32(e.Value) > 0)
valorIndicador = 1;
bitmap = pivotGridControl.GetKPIBitmap(e.DataField.KPIGraphic, valorIndicador);
e.Graphics.FillRectangle(new SolidBrush(e.Appearance.BackColor), e.Bounds);
e.Bounds.Left + (e.Bounds.Width - bitmap.Width) / 2,
e.Bounds.Top + (e.Bounds.Height - bitmap.Height) / 2);
e.Handled = true;
You can achieve your goal via the PivotGridControl.CustomExportCell event. This event provides a CustomPrintEventArgs.Brick property, that allows you to customize the content of the exported cell. Please note that you should specify a PictureEdit control as an Inplace Editor to export image within the cell.
I've modified the sample project to illustrate this approach. You can find it in the attachment.
BTW: I've found a bug in the PivotGridControl.CustomDrawCell event. Here is a corresponding issue in our Support Center.
The PivotGridControl.CustomDrawCell event works incorrectly after showing a preview