Ver Mensaje Individual
  #2  
Antiguo 11-11-2015
Yugo Yugo is offline
Miembro
NULL
 
Registrado: jul 2014
Posts: 25
Reputación: 0
Yugo Va por buen camino
Solucionado!! a medias... en lugar de emplear un componente TDBChart, usé un TChart colocado en el mismo formulario que la base de datos de la que obtiene los datos.


Código:
const int NUM_CELDAS= 13; 
const String CELDA[NUM_CELDAS] = {"Servicio","NC1","NC2","NC3",
                        "NC4","NC5","NC6","NC7","NC8",
                        "NC9","NC10","NC11","NC12"};
            
//Comprobar si hay una serie graficada
  if (Chart1->SeriesCount() > 0)
  {
    //Si hay una serie graficada, se elimina
    //para volver a graficar otra nueva.
    Chart1->RemoveAllSeries();
  }

  // Añadir una TBarSeries al TChart1
  TBarSeries *RxLevFull = new TBarSeries(this);
  RxLevFull->ParentChart = Chart1;

  //Cambiar el título del Chart:
  Chart1->Title->Text->Text = "Titulo";
  //Limpiamos cualquier Style configurado previamente:
  Chart1->Title->Font->Style = TFontStyles();
  Chart1->Title->Font->Style = TFontStyles()<< fsBold;

  //Para cambiar la etiqueta del eje X:
  Chart1->BottomAxis->Title->Caption = "[Celda]";
  //Limpiamos cualquier Style que previamente haya sido configurado:
  Chart1->Title->Font->Style = TFontStyles();
  Chart1->BottomAxis->Title->Font->Style = TFontStyles()<< fsBold;

  //Para cambiar la etiqueta del eje Y:
  Chart1->LeftAxis->Title->Caption = "[Nivel]";
  //Limpiamos cualquier Style configurado previamente:
  Chart1->Title->Font->Style = TFontStyles();
  Chart1->LeftAxis->Title->Font->Style = TFontStyles()<< fsBold;

  //Para cambiar el valor de cada punto de las barras:
  RxLevFull->Marks->Style = smsValue; 

  Chart1->LeftAxis->AxisValuesFormat = "#,##0.00";

  //1º punto de la serie con el valor 'CAMPO1'):
  RxLevFull->Add(Table1->FieldValues["CAMPO1"],CELDA[0],clRed);
  //Los sisguientes puntos de la serie(2º al 13º) para los valores 'CAMPO2', 'CAMPO3', 'CAMPO4',....,'CAMPO13'):
  String ncelda, dato;
  double valorMod = 0;
  for(int i=1; i<NUM_CELDAS; i++)
  {
    ncelda = "NC" + IntToStr(i) + "REGISTRADO";
    dato = Table1->FieldValues[ncelda];
    RxLevFull->Add(valorMod,CELDA[i],clRed);
  }
Responder Con Cita