I have a problem linking my data source Progress with Telerik radchartview - Forum - OpenEdge General - Progress Community

I have a problem linking my data source Progress with Telerik radchartview

 Forum

I have a problem linking my data source Progress with Telerik radchartview

This question is not answered

Hello 

I need to develop a window that throws a bar chart, currently use the bindingSource of Progress and Telerik UI for WinForms.

I tried these two methods, each method in their respective file. so there are two different data sources.

================================================== ==============
Solution 1:

I follow the steps in this link:

http://www.telerik.com/videos/winforms/getting-started-with-radchartview-for-winforms

The problem arises when I finish using the wizard Telerik. And the visual control does not display any bar chart :(.

I tried using other controls to see if the bug occurred only with this control. I obtained the same results.

================================================== ==============

Solution 2:

I implemented the configuration of the attachment of the post of Paul Radbone:

https://community.progress.com/community_groups/openedge_development/f/19/p/23039/80620#80620

I obtained results for grid controls.

The bar chart now displays categories, however, are only the number of records in my table. Although they are not bar charts such.

================================================== ==============

My question is what can be done in both cases to work properly and what I'm doing wrong?

Thank you for your attention, really I am grateful to anyone who can support me. Greetings.


Deputy screenshots and source code.

 
/*------------------------------------------------------------------------
   File        : laGrafica
   Purpose     : 
   Syntax      : 
   Description : 
   Author(s)   : Daniel
   Created     : Mon Oct 03 15:33:38 CDT 2016
   Notes       : 
 ----------------------------------------------------------------------*/

USING Progress.Lang.*.
USING Progress.Windows.Form.

BLOCK-LEVEL ON ERROR UNDO, THROW.

CLASS pruebas.laGrafica INHERITS Form: 
	
    DEFINE PRIVATE VARIABLE bindingSourceTap AS Progress.Data.BindingSource         NO-UNDO.
    DEFINE PRIVATE VARIABLE chartTAP         AS Telerik.WinControls.UI.RadChartView NO-UNDO.
    DEFINE PRIVATE VARIABLE components       AS System.ComponentModel.IContainer    NO-UNDO.
    DEFINE PRIVATE VARIABLE radGridView1 AS Telerik.WinControls.UI.RadGridView NO-UNDO.
    DEFINE PRIVATE VARIABLE rEmpleadoGrid    AS System.Windows.Forms.DataGridView   NO-UNDO.
    

    /*---------------------INICIO: Código generado manualmente------------------*/
    DEFINE         VARIABLE hTTEmpleado      AS HANDLE                              NO-UNDO.

    DEFINE         VARIABLE hDataSet         AS HANDLE                              NO-UNDO.
    DEFINE         VARIABLE hBuffTTEmpleado  AS HANDLE                              NO-UNDO.
    DEFINE         VARIABLE hEmpleadoQry     AS HANDLE                              NO-UNDO.

    DEFINE TEMP-TABLE ttEmpleado NO-UNDO LIKE Empleado.

    DEFINE DATASET dsEmpleado FOR ttEmpleado.
    
    /*---------------------METODO Custom(): generado manualmente------------------*/
    METHOD PRIVATE VOID Custom():
       
        hDataSet    = DATASET dsEmpleado:HANDLE.

        hTTEmpleado = TEMP-TABLE ttEmpleado:HANDLE.

        hBuffTTEmpleado  = hTTEmpleado:DEFAULT-BUFFER-HANDLE.
        
        /* Define la fuente de datos */
        DEFINE DATA-SOURCE dEmp FOR Empleado.
       
        /* Une la fuente de datos al buffer del dataset */
        hBuffTTEmpleado:ATTACH-DATA-SOURCE(DATA-SOURCE dEmp:HANDLE,?,?,?).

        /* Llena el dataset usando la fuente de datos */
        hDataSet:FILL().
        
        /* Consulta de navegacion para empleado */
        hEmpleadoQry = hDataSet:TOP-NAV-QUERY().
        hEmpleadoQry:QUERY-PREPARE("for EACH ttEmpleado where nombre <> ''").
        hEmpleadoQry:QUERY-OPEN().  
        hEmpleadoQry:GET-NEXT(). 

        /* Despliega todos los empleados en la rejilla */
        bindingSourceTap = NEW Progress.Data.BindingSource(hEmpleadoQry, "*", "").

        /* Disable editing because procedure does not include event logic to handle
           changes. */
        bindingSourceTap:AllowEdit   = FALSE.
        bindingSourceTap:AllowRemove = FALSE.
        rEmpleadoGrid:Name       = "CustGrid".
        rEmpleadoGrid:Text       = "Customer Grid".
        rEmpleadoGrid:DataSource = bindingSourceTap.
        radGridView1:DataSource = bindingSourceTap.
        rEmpleadoGrid:TabIndex   = 1.
        /*_______Zona de pruebas_________*/        
        
        chartTAP:DataSource = bindingSourceTap.
        
    /*_______Zona de pruebas_________*/
    END METHOD.
    /*---------------------FIN: Código generado manualmente------------------*/
		
    CONSTRUCTOR PUBLIC laGrafica (  ):
		
		
        SUPER().
        InitializeComponent().
        Custom().
        THIS-OBJECT:ComponentsCollection:ADD(THIS-OBJECT:components).
        CATCH e AS Progress.Lang.Error:
            UNDO, THROW e.
        END CATCH.

    END CONSTRUCTOR.

    METHOD PRIVATE VOID InitializeComponent(  ):
		
        /* NOTE: The following method is automatically generated.
        
        We strongly suggest that the contents of this method only be modified using the
        Visual Designer to avoid any incompatible modifications.
        
        Modifying the contents of this method using a code editor will invalidate any support for this file. */
        THIS-OBJECT:components = NEW System.ComponentModel.Container().
        @VisualDesigner.FormMember (NeedsInitialize="true").
        DEFINE VARIABLE cartesianArea1 AS Telerik.WinControls.UI.CartesianArea NO-UNDO.
        cartesianArea1 = NEW Telerik.WinControls.UI.CartesianArea().
        @VisualDesigner.FormMember (NeedsInitialize="true").
        DEFINE VARIABLE categoricalAxis1 AS Telerik.WinControls.UI.CategoricalAxis NO-UNDO.
        categoricalAxis1 = NEW Telerik.WinControls.UI.CategoricalAxis().
        @VisualDesigner.FormMember (NeedsInitialize="true").
        DEFINE VARIABLE linearAxis1 AS Telerik.WinControls.UI.LinearAxis NO-UNDO.
        linearAxis1 = NEW Telerik.WinControls.UI.LinearAxis().
        @VisualDesigner.FormMember (NeedsInitialize="true").
        DEFINE VARIABLE barSeries1 AS Telerik.WinControls.UI.BarSeries NO-UNDO.
        barSeries1 = NEW Telerik.WinControls.UI.BarSeries().
        @VisualDesigner.FormMember (NeedsInitialize="true").
        DEFINE VARIABLE barSeries2 AS Telerik.WinControls.UI.BarSeries NO-UNDO.
        barSeries2 = NEW Telerik.WinControls.UI.BarSeries().
        @VisualDesigner.FormMember (NeedsInitialize="true").
        DEFINE VARIABLE tableViewDefinition1 AS Telerik.WinControls.UI.TableViewDefinition NO-UNDO.
        tableViewDefinition1 = NEW Telerik.WinControls.UI.TableViewDefinition().
        THIS-OBJECT:bindingSourceTap = NEW Progress.Data.BindingSource(THIS-OBJECT:components).
        THIS-OBJECT:rEmpleadoGrid = NEW System.Windows.Forms.DataGridView().
        THIS-OBJECT:chartTAP = NEW Telerik.WinControls.UI.RadChartView().
        THIS-OBJECT:radGridView1 = NEW Telerik.WinControls.UI.RadGridView().
        CAST(THIS-OBJECT:bindingSourceTap, System.ComponentModel.ISupportInitialize):BeginInit().
        CAST(THIS-OBJECT:rEmpleadoGrid, System.ComponentModel.ISupportInitialize):BeginInit().
        CAST(THIS-OBJECT:chartTAP, System.ComponentModel.ISupportInitialize):BeginInit().
        CAST(THIS-OBJECT:radGridView1, System.ComponentModel.ISupportInitialize):BeginInit().
        CAST(THIS-OBJECT:radGridView1:MasterTemplate, System.ComponentModel.ISupportInitialize):BeginInit().
        THIS-OBJECT:SuspendLayout().
        /*  */
        /* bindingSourceTap */
        /*  */
        THIS-OBJECT:bindingSourceTap:MaxDataGuess = 0.
        THIS-OBJECT:bindingSourceTap:NoLOBs = FALSE.
        THIS-OBJECT:bindingSourceTap:TableSchema = ?.
        /*  */
        /* rEmpleadoGrid */
        /*  */
        THIS-OBJECT:rEmpleadoGrid:ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode:AutoSize.
        THIS-OBJECT:rEmpleadoGrid:Location = NEW System.Drawing.Point(35, 28).
        THIS-OBJECT:rEmpleadoGrid:Name = "rEmpleadoGrid".
        THIS-OBJECT:rEmpleadoGrid:Size = NEW System.Drawing.Size(978, 169).
        THIS-OBJECT:rEmpleadoGrid:TabIndex = 0.
        /*  */
        /* chartTAP */
        /*  */
        THIS-OBJECT:chartTAP:AreaDesign = cartesianArea1.
        categoricalAxis1:IsPrimary = TRUE.
        categoricalAxis1:LabelRotationAngle = Progress.Util.CastUtil:ToDouble("300").
        categoricalAxis1:Title = "".
        linearAxis1:AxisType = Telerik.Charting.AxisType:Second.
        linearAxis1:IsPrimary = TRUE.
        linearAxis1:LabelRotationAngle = Progress.Util.CastUtil:ToDouble("300").
        linearAxis1:TickOrigin = ?.
        linearAxis1:Title = "".
        @VisualDesigner.FormMember (NeedsInitialize="false", InitializeArray="true").
        DEFINE VARIABLE arrayvar0 AS Telerik.WinControls.UI.Axis EXTENT 2 NO-UNDO.
        arrayvar0[1] = categoricalAxis1.
        arrayvar0[2] = linearAxis1.
        THIS-OBJECT:chartTAP:Axes:AddRange(arrayvar0).
        THIS-OBJECT:chartTAP:Location = NEW System.Drawing.Point(35, 442).
        THIS-OBJECT:chartTAP:Name = "chartTAP".
        barSeries1:HorizontalAxis = categoricalAxis1.
        barSeries1:LabelMode = Telerik.WinControls.UI.BarLabelModes:Top.
        barSeries1:VerticalAxis = linearAxis1.
        barSeries2:HorizontalAxis = categoricalAxis1.
        barSeries2:LabelMode = Telerik.WinControls.UI.BarLabelModes:Top.
        barSeries2:VerticalAxis = linearAxis1.
        @VisualDesigner.FormMember (NeedsInitialize="false", InitializeArray="true").
        DEFINE VARIABLE arrayvar1 AS Telerik.WinControls.UI.ChartSeries EXTENT 2 NO-UNDO.
        arrayvar1[1] = barSeries1.
        arrayvar1[2] = barSeries2.
        THIS-OBJECT:chartTAP:Series:AddRange(arrayvar1).
        THIS-OBJECT:chartTAP:ShowGrid = FALSE.
        THIS-OBJECT:chartTAP:Size = NEW System.Drawing.Size(978, 244).
        THIS-OBJECT:chartTAP:TabIndex = 1.
        THIS-OBJECT:chartTAP:Text = "radChartView1".
        /*  */
        /* radGridView1 */
        /*  */
        THIS-OBJECT:radGridView1:Location = NEW System.Drawing.Point(35, 218).
        /*  */
        /*  */
        /*  */
        THIS-OBJECT:radGridView1:MasterTemplate:DataSource = THIS-OBJECT:bindingSourceTap.
        THIS-OBJECT:radGridView1:MasterTemplate:ViewDefinition = tableViewDefinition1.
        THIS-OBJECT:radGridView1:Name = "radGridView1".
        THIS-OBJECT:radGridView1:Size = NEW System.Drawing.Size(978, 200).
        THIS-OBJECT:radGridView1:TabIndex = 2.
        THIS-OBJECT:radGridView1:Text = "radGridView1".
        /*  */
        /* laGrafica */
        /*  */
        THIS-OBJECT:ClientSize = NEW System.Drawing.Size(1036, 710).
        THIS-OBJECT:Controls:Add(THIS-OBJECT:radGridView1).
        THIS-OBJECT:Controls:Add(THIS-OBJECT:chartTAP).
        THIS-OBJECT:Controls:Add(THIS-OBJECT:rEmpleadoGrid).
        THIS-OBJECT:Name = "laGrafica".
        THIS-OBJECT:Text = "laGrafica".
        CAST(THIS-OBJECT:bindingSourceTap, System.ComponentModel.ISupportInitialize):EndInit().
        CAST(THIS-OBJECT:rEmpleadoGrid, System.ComponentModel.ISupportInitialize):EndInit().
        CAST(THIS-OBJECT:chartTAP, System.ComponentModel.ISupportInitialize):EndInit().
        CAST(THIS-OBJECT:radGridView1:MasterTemplate, System.ComponentModel.ISupportInitialize):EndInit().
        CAST(THIS-OBJECT:radGridView1, System.ComponentModel.ISupportInitialize):EndInit().
        THIS-OBJECT:ResumeLayout(FALSE).
        CATCH e AS Progress.Lang.Error:
            UNDO, THROW e.
        END CATCH.
    END METHOD.

    DESTRUCTOR PUBLIC laGrafica ( ):

    END DESTRUCTOR.

END CLASS.

.

All Replies
  • I don't know why your 2nd approach is not working.  It seems like it should be.  You could try calling bindingSourceTap:RefreshAll() after you bind it to the chart.  But you really shouldn't have to.

    With the first approach, do you bind the chart to the BindingSource and the BindingSource1 to the query anywhere?  Sorry if you showed this somewhere - it's kind of teeny! You would bind the chart to the BindingSource using PDSOE - just set the DataSource property in the property sheet.  BindingSource1 should be in the drop down.  Also, you'd need to call a slightly modified version of Custom().  Instead of creating the BindingSource in there, you just need to hook the BindingSource that's already on the form to the query handle.  So instead of :

       bindingSourceTap = NEW Progress.Data.BindingSource(hEmpleadoQry, "*", "").

    You would do:

       bindingSource1:Handle = hEmpleadoQry.

  • Laura,
     
    Would the DEFINE DATA-SOURCE statement in the Custom() method have anything to play in this?  It’s a static define within a method and I would expect it to go away once the method is finished.
     
    Brian

  • Don't think so.  Once the Fill() happens, I don't think that Data-Source object will be used anymore.

  • Okay.  Wasn’t sure and I had another customer who had done something similar with a static query defined in a method where the grid showed all the columns but no data and defining the query at the class level resolved the problem.

  • My apologies, I forgot to let you know that every solution belongs to a different file, because of that reason is that there are two different data sources.

  • Thanks, but  I wasn't confused about that.  Did I say something that made it sound like i was?

  • No, but I thought that if necessary the above code could be misinterpreted. And also influences my level with the English language is somewhat low.

    Anyone know or has any example that I can base to develop graphics with Telerik and OpenEdge?

  • I ended doing this:

    /*Categoria*/      
    
           @VisualDesigner.FormMember (NeedsInitialize="true").
    
           DEFINE VARIABLE miCategoria     AS Telerik.Charting.CategoricalDataPoint NO-UNDO.        
    
           /*Los espacios declarados son los mismos que deben llenarse*/  
    
           DEFINE VARIABLE dimension       AS INTEGER                               NO-UNDO .
    
           DEFINE VARIABLE ListaCategorias AS Telerik.Charting.DataPoint            EXTENT NO-UNDO.
    
           DEFINE VARIABLE contador        AS INTEGER                               NO-UNDO INIT 1.
    
           FOR EACH Empleado WHERE Empleado.Nombre <> "":
    
               ASSIGN
    
                   dimension = dimension + 1.
    
           END.
    
           EXTENT (ListaCategorias) = dimension.
    
           FOR EACH Empleado WHERE Empleado.Nombre <> "":        
    
               miCategoria = NEW Telerik.Charting.CategoricalDataPoint().
    
               miCategoria:Category = Empleado.Nombre.  
    
               miCategoria:Label = Progress.Util.CastUtil:ToDouble(Empleado.Nomina).
    
               miCategoria:Value = Progress.Util.CastUtil:ToDouble(Empleado.Nomina).
    
               ListaCategorias[contador] = miCategoria.
    
               contador = contador + 1.
    
           END.
    
    

    It is was the only way i could do it dinamically Smile .