Use Windows.pkg Use DFClient.pkg Use Customer.DD Use dfTable.pkg Use cComWebBrowser.pkg // de ....\VDF12.1\Examples\Example Library\AppSrc Use dfLine.pkg Use DfCentry.pkg Use dfTable.pkg Use Flexml.pkg Use for_all.pkg //******************************** // Para ubicar garfico y no andar cambiando en todo el codigo del programa // En aplicacion final sustituir por parametro en tabla sistema u otra tecnica // Ejemplo combinado con PATh de datos: // // String sURL // String sDataPath // // Get psDataPath of (phoWorkspace(ghoApplication)) to sDataPath // Get PathAtIndex of (phoWorkspace(ghoApplication)) sDataPath 1 to sDataPath // Move "" to sURL // Append sURL sDataPath "\FusionChartsFree\Gallery\Line2D.html" // // Send ComNavigate of oComWebBrowser1 sURL 0 0 0 0 // // 12345678.12345678901234 // 8 maximo nombre tabla. 14 maximo nombre campo //#Replace GRAFICOS.PATHUBICA "..\Graficos\Gallery\" // ubicacion graficos #Replace GRAFICOS.PATHUBICA "D:\Moose\Order Entry con graficos VDF12.1\Graficos\Gallery\" // tendreis que "jugar" con la ubicacion en red etc. #Replace GRAFICOS.NOMBREGRAFICO "Line2D.html" // nombre de la "plantilla" de grafico #Replace GRAFICOS.PATHDATOS "..\Graficos\Gallery\Data\" // ubicacion datos graficos. Carpeta "data" tiene que existir y estra siempre por encima de ....\gallery #Replace GRAFICOS.DATOSGRAFICO "Line2D.xml" // nombre del archivo xml que contiene los datos //******************************************************************************* // Agradecimientos: //****************** // Benito Fernandez de Norquimia (gracias Benito) por indicarnos la existencia de estas librerias y por este ejemplo inicial //******************************************************************* // // Datos a tener en cuenta // a) Ojo con permisos de navegador para abrir ActiveX. Una forma de comprobarlo si se ve que da problemas // es ejecutando el .html (IE, FireFox, Opera..) correspondiente desde ....\Gallery. Hay que tener en cuenta que exista // archivo con datos (ver punto c) // b) Las carpetas obligatorias son las que figuran en este ejemplo en "graficos". Contenido de "gallery" puede variar dependiendo // de los graficos que se vayan a usar. Por defecto estan todos // c) Carpeta "data" tiene que estar por encima de "gallery" (...\gallery\data) // d) Librerias de graficos y condiciones de uso en http://www.fusioncharts.com/free/ // --------------------------------- // // Se agradece cualquier contribucion a la mejora de este ejemplo. :-) // Como sugerencias de mejora: // i) Get psHome of (phoWorkspace(ghoApplication)) to sDirectorioRaiz // entonces graficos.pathubica= sDirectorioRaiz+"\Graficos\Gallery\" //*************************************************************************************** Deferred_View Activate_oCustomerGrafica for ; Object oCustomerGrafica is a dbView Object oCustomer_DD is a Customer_DataDictionary End_Object Set Main_DD to oCustomer_DD Set Server to oCustomer_DD Set Border_Style to Border_Normal Set Size to 264 638 Set Location to 2 2 Set Label to "Ejemplo gr fico" Object oDbGrid1 is a dbGrid Set Size to 215 202 Set Location to 12 7 Begin_Row Entry_Item Customer.Customer_Number Entry_Item Customer.Name Entry_Item Customer.Purchases End_Row Set Main_File to Customer.File_number Set Form_Width 0 to 30 Set Header_Label 0 to "Cądigo" Set Form_Width 1 to 115 Set Header_Label 1 to "Nombre" Set Form_Width 2 to 43 Set Header_Label 2 to "Compras" End_Object Object oComWebBrowser1 is a cComWebBrowser Set Size to 214 413 Set Location to 12 212 Procedure OnCreate Forward Send OnCreate // ToDo: Set the ActiveX properties here... End_Procedure // OnCreate End_Object Object oDibujar is a Button Set Label to "Dibujar" Set Location to 228 566 Set peAnchors to anTopRight // Display the sample help HTML file Procedure OnClick String sName String sPaths sPath Handle hoWorkspace Send GeneroGraficosLine2D Send Navigate // and navigate to it. End_Procedure // OnClick End_Object Procedure Navigate String sURL String sHome String sDataPath // *WvA: Oct 14, 2008, removed hardcoded path and replaced it with one from // the application object //Necesario tantos como graficos tengais //Move (GRAFICOS.PATHUBICA+GRAFICOS.nombreGRAFICO) to sURL Get psHome of (phoWorkspace(ghoApplication)) to sHome Move (sHome+"Graficos\Gallery\"+GRAFICOS.nombreGRAFICO) to sURL Send ComNavigate of oComWebBrowser1 sURL 0 0 0 0 End_Procedure Procedure GeneroGraficosLine2D Integer bTest iRegistro Handle hoRoot hoXML String sDataPath sPath String sFile sQuery sValor1 sValor2 sValor3 Handle hoTable hoOtro hoOtro2 Integer bRetVal iItemCount iCount Boolean bUseCData String sTitulo sSubtitulo sEjeX sEjeY //Borro datos anteriores //Aqui mejor usar las librerias de vWin32th (vdf-guidance) para borrar archivo //y comprobar que realmente se ha borrado Move (GRAFICOS.PATHDATOS+GRAFICOS.DATOSGRAFICO) to sPath EraseFile sPath Get Create U_cXMLDOMDocument to hoXML Set psDocumentName of hoXML to sPath Get LoadXMLDocument of hoXML to bTest // get documentelement. If it exists we are editing an xml file. If // it does not exist, its a new file, create the doc element node Get DocumentElement of hoXML to hoRoot If not hoRoot Begin Get CreateDocumentElement of hoXML "Graph" to hoRoot Move "TITULO EJEMPLO GRAFICO" to sTitulo Move "SUBTITULO EJEMPLO GRAFICO" to sSubtitulo Move "Eje X" to sEjeX Move "Eje Y" to sEjeY Send AddAttribute of hoRoot "Caption" sTitulo Send AddAttribute of hoRoot "Subcaption" sSubtitulo Send AddAttribute of hoRoot "xAxisName" sEjeX Send AddAttribute of hoRoot "yAxisMinValue" "1000" Send AddAttribute of hoRoot "yAxisName" sEjeY Send AddAttribute of hoRoot "DecimalPrecision" "2" End Open Customer Clear Customer Find ge Customer by Index.1 for_all customer by Index.1 Constrain customer.Customer_Number lt 21 // como ejemplo trata los 20 primeros do Move customer.Customer_Number to sValor1 //Eje X Move customer.Purchases to sValor2 //Eje Y Move customer.Name to sValor3 Move ("set[@name='" + sValor1 + "']") to sQuery Get FindNode of hoRoot sQuery to hoTable // see such a node exists // If a node is returned, it exists. Ask what to do. If hoTable Begin Get RemoveNode of hoRoot hoTable to hoTable Send destroy of hoTable // continue on writing the table End Get AddElement of hoRoot "set" sValor1 to hoOtro Send AddAttribute of hoOtro "name" sValor1 Send AddAttribute of hoOtro "value" sValor2 Send AddAttribute of hoOtro "hoverText" sValor3 End_For_All Send Destroy of hoRoot // root node no longer needed // Save the XML file Get SaveXMLDocument of hoXML to bTest Send Destroy of hoXML // XML document no longer needed End_Procedure Cd_End_Object