Histórico da Página
HTML |
---|
<div id="main-content" class="wiki-content group"> <p class="MsoNormal">El visualizador de gráficos tiene como principal objetivo permitir que otras aplicaciones puedan mostrar gráficos personalizados dentro de Fluig. Para ello, basta sólo con registrar el servicio de gráfico en Fluig y proporcionar dos métodos rest. Uno que informará los parámetros de configuración del gráfico y otro que pondrá a disposición los datos>The main objective of the Graph Viewer is to allow other applications to display customized graph within Fluig. In order to do that, the application just has to register your graph service in Fluig and provide two rest methods. One that will provide the configuration parameters of the graph, and another that will provide the data.</p> <p class="MsoNormal"> <span style="font-size: 10.0pt; line-height: 13.0pt;">El>The Graph VisualizadorViewer allows deto Gráficosdisplay permitein exhibirthe enfollowing formatoformats: tablatable, gráfico decolumn columnachart yand gráficopie de tortachart.</span> </p> <p class="MsoNormal"> <span style="font-size: 10.0pt; line-height: 13.0pt;"><img class="confluence-embedded-image" src="http://www.tdn.totvs.com/download/attachments/80970184/grafico1.png?version=1&modificationDate=1380654979000&api=v2" data-image-src="http://www.tdn.totvs.com/download/attachments/80970184/grafico1.png?version=1&modificationDate=1380654979000&api=v2"></span> </p> <p class="MsoNormal"> <span style="font-size: 10.0pt; line-height: 13.0pt;"><img class="confluence-embedded-image" src="http://www.tdn.totvs.com/download/attachments/80970184/grafico2.png?version=1&modificationDate=1380654979000&api=v2" data-image-src="http://www.tdn.totvs.com/download/attachments/80970184/grafico2.png?version=1&modificationDate=1380654979000&api=v2"><br /></span> </p> <p class="MsoNormal"> <span style="font-size: 10.0pt; line-height: 13.0pt;"><img class="confluence-embedded-image" src="http://www.tdn.totvs.com/download/attachments/80970184/grid.png?version=1&modificationDate=1380654979000&api=v2" data-image-src="http://www.tdn.totvs.com/download/attachments/80970184/grid.png?version=1&modificationDate=1380654979000&api=v2"></span> </p> <p class="MsoNormal"> <strong style="font-size: 10.0pt; line-height: 13.0pt;">1. RegistrarRegister elthe serviciodata deservice datosin en Fluig.</strong> </p> <p class="MsoNormal">Para>To register registrarthe elgraph serviciodata deservice, datosjust delsend gráficoan bastaasynchronous conmessage enviar un mensaje asincrónico a to Fluig.</p> <p class="MsoNormal">El>The desarrolladordeveloper deberámust utilizaruse elthe eventoevent "REGISTER_CHART_SERVICE". SeráYou necesarioneed pasarto unpass objetoan deobject tipotype ChartServiceVO conwith losthe datosdata delof serviciothe dedata datosservice enin cuestiónquestion.</p> <p class="MsoNormal"> ElThe objetoobject ChartServiceVO, disponibleavailable enin el paquetepackage com.totvs.technology.wcm.common.chart, estáis composed compuestoby porthe losfollowing siguientes elementoselements:<br /> <span style="font-size: 10.0pt; line-height: 13.0pt;">String id: códigograph delservice serviciocode<br de gráfico<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">String description: descripcióngraph del servicio de gráfico<brservice description<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">String ParametersRest: URL delof serviciothe rest queservice that devolveráwill los parámetros<brreturn the parameters<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">String dataRest: URL delof serviciothe rest service quethat devolveráwill losreturn datosthe delgraph gráfico<data</span> </p> <p class="MsoNormal"> <strong>Ejemplo<strong>Example:</strong> </p> <p class="MsoNormal"> ChartServiceVO ecm1 = new ChartServiceVO("ECM1", "ECM - Volumes: Space EspacioUsed utilizado (porPer volumenVolume enin %) ");<br /> <span <span style="font-size: 10.0pt; line-height: 13.0pt;">ecm1.setDataRest(“</span><a href="http://localhost:8080/portal/ecm/api/rest/ecm/volume/chartDataByVolume" style="font-size: 10.0pt; line-height: 13.0pt;" class="external-link" rel="nofollow">http://localhost:8080/portal/ecm/api/rest/ecm/volume/chartDataByVolume</a><span style="font-size: 10.0pt; line-height: 13.0pt;">");<br /></span><span style="font-size: 10.0pt; line-height: 13.0pt;">ecm1.setParametersRest(“</span><a href="http://localhost:8080/portal/ecm/api/rest/ecm/volume/chartParametersByVolume" style="font-size: 10.0pt; line-height: 13.0pt;" class="external-link" rel="nofollow">http://localhost:8080/portal/ecm/api/rest/ecm/volume/chartParametersByVolume</a><span style="font-size: 10.0pt; line-height: 13.0pt;">");<br /></span><span style="font-size: 10.0pt; line-height: 13.0pt;">IntegrationUtil.sendAsyncMessage(WCMAsyncEvents.REGISTER_CHART_SERVICE.getEvent(), ecm1);</span> </p> <p class="MsoNormal">Este>This registrorecord semust debebe ejecutarrun cadaeach veztime que sethe deployaapplication lais aplicacióndeployed, esthat deciris, every cadatime vezFluig queis subeup. elIn fluig.order Parato ello, sugerimos crear un do that, we suggest that a servlet enis sucreated aplicaciónin conyour laapplication opciónwith the option loadOnStartup = 1, quewhich sewill encargaráperform de cumplir esta tareathis task.</p> <p class="MsoNormal"> <strong>2. ServiciosParameter de Parámetros<Services</strong><span style="font-size: 10.0pt; line-height: 13.0pt; text-indent: -24.0px;"> </span> </p> <p class="MsoNormal"> <span style="font-size: 10.0pt; line-height: 13.0pt; text-indent: -24.0px;">Este>This serviciorest restservice deberámust devolverreturn unaa listalist deof ChartParameterVO, which quewill contendrá los parámetros que su servicio de datos necesitará paracontain the parameters that your data service will need to supply the proporcionargraph losdata. datosBased delon gráfico.this Enservice, baseFluig awill estebuild serviciothe el Fluigconfiguration construirá la pantalla de configuraciónscreen.<br /> <br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">El>ChartParameterVO ChartParameterVO (pacote com.totvs.technology.wcm.common.chart package) esta is composed by the compueto por los siguientes elementosfollowing elements:<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">int code código id: sequential numeric códigocode numéricothat secuencialwill quebe seused utilizaráfor parasubsequent ladata búsqueda de los datos posteriormente.<br search<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">String title: field nombrename delas campoit comowill apareceráappear enon lathe pantalla<brscreen<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">String type: tipofield de campotype (ChartParameterVO.TYPE_STRING, ChartParameterVO.TYPE_NUMBER, ChartParameterVO.TYPE_DATA ouor ChartParameterVO.TYPE_BOOLEAN)<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">String AllowedList:iIf sithe elfield campois esof tipothe string type, puedenoptions desplegarsecan una listabe con opciones para que el usuario seleccione. Estas opciones estánprovided for the user to select from a list. These options are separadasseparated porby “";”<br"<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">boolean multipleSelection - > true/false, enif casoit deallows quemultiple permita o no laselection or selecciónnot, múltipleif si el AllowedList estáis enin uso.<bruse<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">String value - > ValorInitial inicialvalue, siif existe<any</span> </p> <p class="MsoNormal"> <strong>Exemplo<strong>Example:<br /></strong><span style="font-size: 10.0pt; line-height: 13.0pt;">List<ChartParameterVO> params = new ArrayList<>();<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">ChartParameterVO param1 = new ChartParameterVO();<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">param1.setCode(1);<br /></span><span style="font-size: 10.0pt; line-height: 13.0pt;">param1.setTitle("Código deldo ÍtemItem");<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">param1.setType(ChartParameterVO.TYPE_STRING);<br /></span><span style="font-size: 10.0pt; line-height: 13.0pt;">param1.setAllowedList(“Item 1;Item 2;Item 3”);<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">param1.setMultipleSelection(ChartParameterVO.SELECTION_UNIQUE);<br /></span><span style="font-size: 10.0pt; line-height: 13.0pt;">params.add(param1);</span> </p> <p class="MsoNormal"> ChartParameterVO param2 = new ChartParameterVO();<br /> <span <span style="font-size: 10.0pt; line-height: 13.0pt;">param2.setCode(2);<br /></span><span style="font-size: 10.0pt; line-height: 13.0pt;">param2.setTitle("ExhibirDisplay solamenteonly ítemsactive activositems");<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">param2.setType(ChartParameterVO.TYPE_BOOLEAN);<br /></span><span style="font-size: 10.0pt; line-height: 13.0pt;">params.add(param2);<br /></span><span style="font-size: 10.0pt; line-height: 13.0pt;">return params;<br /> <span style="font-size: 10.0pt; line-height: 13.0pt;"><br /> <br /> <strong>3. ServicioData de Datos<Service</strong><br /> <br />El>The servicio REST deberá devolver unaREST service must return a </span><span style="font-size: 10.0pt; font-family: Consolas; color: black; background: silver;">ChartVO</span><span style="font-size: 10.0pt; font-family: Consolas; color: black;">, conwith losthe datosdata parato exhibirdisplay elthe gráficograph.<br /> </span><span> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">O ChartVO>ChartVO (paquete com.totvs.technology.wcm.common.chart package) is estácomposed compuestoby porthe losfollowing siguientes elementoselements:<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">String title: títulotitle that quewill sebe exhibirádisplayed enin elthe gráfico<brgraph<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">String description: descripcióngraph deldescription<br gráfico<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">String type: tipograph do gráficotype (ChartTypes.column.getName(), ChartTypes.pie.getName(), ChartTypes.table.getName()<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">Map<String, Object>[] source: datosgraph deldata<br gráfico<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">ChartCategoryVO category: categorías<brcategories<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">ChartSerieGroupVO[] seriesGroups: gruposgroups deof series</span> </p> <p class="MsoNormal"> <strong>Ejemplo<strong>Example parafor una GráficoPie de tortachart:</strong> </p> <p class="MsoNormal"> ChartVO result = new ChartVO("EspacioEspaço utilizado", "VolumenVolume " + codVolFisic,ChartTypes.pie.getName());<br /> <span style="font-size: 10.0pt; line-height: 13.0pt; text-indent: -35.4pt;">Map<String, Object>[] source = new Map[2];<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">Map<String, Object> data0 = new HashMap<String, Object>();<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">data0.put("label","Utilizado");<br /></span><span style="font-size: 10.0pt; line-height: 13.0pt;">data0.put("size",80);<br /></span><span style="font-size: 10.0pt; line-height: 13.0pt;">source[0] = data0;</span> </p> <p class="MsoNormal"> Map<String, Object> data1 = new HashMap<String, Object>();<br /> <span style="font-size: 10.0pt; line-height: 13.0pt;">data1.put("label","Livre");<br /></span><span style="font-size: 10.0pt; line-height: 13.0pt;">data1.put("size",20);<br /></span><span style="font-size: 10.0pt; line-height: 13.0pt;">source[1] = data1;<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">result.setSource(source);</span> </p> <p class="MsoNormal"> ChartSerieGroupVO[] seriesGroups = new ChartSerieGroupVO[1];<br /> <span <span style="font-size: 10.0pt; line-height: 13.0pt;">ChartSerieGroupVO serieGroup = new ChartSerieGroupVO(ChartTypes.pie.getName(),"label");<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">ChartSerieVO[] series = new ChartSerieVO[1];<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">ChartSerieVO serie = new ChartSerieVO("size","label");<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">series[0] = serie;<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">serieGroup.setSeries(series);<br /></span><span style="font-size: 10.0pt; line-height: 13.0pt;">seriesGroups[0] = serieGroup;</span> </p> <p class="MsoNormal"> result.setSeriesGroups(seriesGroups);<br /> <span <span style="font-size: 10.0pt; line-height: 13.0pt;">return result;</span> </p> <p class="MsoNormal"> <strong>Ejemplo<strong>Example parafor una GráficoColumn de columnaschart:<br /></strong><span style="font-size: 10.0pt; line-height: 13.0pt;">ChartVO result = new ChartVO("EspacioEspaço utilizado","Todos losos volúmenesvolumes",ChartTypes.column.getName());</span> </p> <p class="MsoNormal">Map<String, Object>[] source = new Map[2]; </p> <p class="MsoNormal"> Map<String, Object> data0 = new HashMap<String, Object>();<br /> <span style="font-size: 10.0pt; line-height: 13.0pt;">data0.put("label",”Item 1”);<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">data0.put("total",100);<br /></span><span style="font-size: 10.0pt; line-height: 13.0pt;">data0.put("used",40);<br /></span><span style="font-size: 10.0pt; line-height: 13.0pt;">data0.put("free",60);<br /></span><span style="font-size: 10.0pt; line-height: 13.0pt;">source[0] = data0;</span> </p> <p class="MsoNormal"> Map<String, Object> data0 = new HashMap<String, Object>();<br /> <span style="font-size: 10.0pt; line-height: 13.0pt;">data0.put("label",”Ítem”Item 2”););<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">data0.put("total",120);<br /></span><span style="font-size: 10.0pt; line-height: 13.0pt;">data0.put("used",60);<br /></span><span style="font-size: 10.0pt; line-height: 13.0pt;">data0.put("free",60);<br /></span><span style="font-size: 10.0pt; line-height: 13.0pt;">source[1] = data0;</span> </p> <p class="MsoNormal">result.setSource(source);</p> <p class="MsoNormal"> ChartCategoryVO category = new ChartCategoryVO("label");<br /> <span <span style="font-size: 10.0pt; line-height: 13.0pt;">result.setCategory(category);</span> </p> <p class="MsoNormal"> ChartSerieGroupVO[] seriesGroups = new ChartSerieGroupVO[1];<br /> <span <span style="font-size: 10.0pt; line-height: 13.0pt;">ChartSerieGroupVO serieGroup = new ChartSerieGroupVO(ChartTypes.column.getName(),"Espaço(Mb)");</span> </p> <p class="MsoNormal"> ChartAxiVO axis = new ChartAxiVO(20,true,"Espaço(Mb)");<br /> <span <span style="font-size: 10.0pt; line-height: 13.0pt;">serieGroup.setValueAxis(axis);</span> </p> <p class="MsoNormal">ChartSerieVO[] series = new ChartSerieVO[3];</p> <p class="MsoNormal"> ChartSerieVO total = new ChartSerieVO("total","Espaço Total");<br /> <span style="font-size: 10.0pt; line-height: 13.0pt;">series[0] = total;</span> </p> <p class="MsoNormal"> ChartSerieVO used = new ChartSerieVO("used","EspacioEspaço Utilizado");<br /> <span style="font-size: 10.0pt; line-height: 13.0pt;">series[1] = used;</span> </p> <p class="MsoNormal"> ChartSerieVO free = new ChartSerieVO("free","EspacioEspaço LibreLivre");<br /> <span <span style="font-size: 10.0pt; line-height: 13.0pt;">series[i] = = free;</span> </p> <p class="MsoNormal"> serieGroup.setSeries(series);<br /> <span <span style="font-size: 10.0pt; line-height: 13.0pt;">seriesGroups[0] = serieGroup;</span> </p> <p class="MsoNormal">result.setSeriesGroups(seriesGroups);</p> <p class="MsoNormal">return this.buildResponse(result);</p> <p class="MsoNormal"> <strong>Ejemplo<strong>Example parafor una GráficoTable de tablaschart:</strong> </p> <p class="MsoNormal">ChartVO result = new ChartVO("EspacioEspaço utilizado","Todos losos volúmenesvolumes",ChartTypes.table.getName());</p> <p class="MsoNormal">Map<String, Object>[] source = new Map[2];</p> <p class="MsoNormal"> Map<String, Object> data0 = new HashMap<String, Object>();<br /> <span style="font-size: 10.0pt; line-height: 13.0pt;">data0.put("label",”Item 1”);<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">data0.put("total",100);<br /></span><span style="font-size: 10.0pt; line-height: 13.0pt;">data0.put("used",40);<br /></span><span style="font-size: 10.0pt; line-height: 13.0pt;">data0.put("free",60);<br /></span><span style="font-size: 10.0pt; line-height: 13.0pt;">source[0] = data0;</span> </p> <p class="MsoNormal"> Map<String, Object> data0 = new HashMap<String, Object>();<br /> <span style="font-size: 10.0pt; line-height: 13.0pt;">data0.put("label",”Ítem”Item 2”););<br /> </span><span style="font-size: 10.0pt; line-height: 13.0pt;">data0.put("total",120);<br /></span><span style="font-size: 10.0pt; line-height: 13.0pt;">data0.put("used",60);<br /></span><span style="font-size: 10.0pt; line-height: 13.0pt;">data0.put("free",60);<br /></span><span style="font-size: 10.0pt; line-height: 13.0pt;">source[1] = data0;</span> </p> <p class="MsoNormal">result.setSource(source);</p> <p class="MsoNormal">ChartSerieGroupVO[] seriesGroups = new ChartSerieGroupVO[1];</p> <p class="MsoNormal">ChartSerieGroupVO serieGroup = new ChartSerieGroupVO(ChartTypes.table.getName(),"EspacioEspaço(Mb)");      </p> <p class="MsoNormal">ChartAxiVO axis = new ChartAxiVO(20,true,"Espaço(Mb)");</p> <p class="MsoNormal">serieGroup.setValueAxis(ejesaxis);</p> <p class="MsoNormal">ChartSerieVO[] series = new ChartSerieVO[4];</p> <p class="MsoNormal"> ChartSerieVO label = new ChartSerieVO("label","Item");<br /> <span <span style="font-size: 10.0pt; line-height: 13.0pt;">series[0] = = label;</span> </p> <p class="MsoNormal"> ChartSerieVO total = new ChartSerieVO("total","Espaço Total");<br /> <span style="font-size: 10.0pt; line-height: 13.0pt;">series[1] = total;</span> </p> <p class="MsoNormal"> ChartSerieVO used = new ChartSerieVO("used","EspacioEspaço Utilizado");<br /> <span style="font-size: 10.0pt; line-height: 13.0pt;">series[2] = used;</span> </p> <p class="MsoNormal"> ChartSerieVO free = new ChartSerieVO("free","EspacioEspaço LibreLivre");<br /> <span <span style="font-size: 10.0pt; line-height: 13.0pt;">series[3] = = free;</span> </p> <p class="MsoNormal"> serieGroup.setSeries(series);<br /> <span <span style="font-size: 10.0pt; line-height: 13.0pt;">seriesGroups[0] = serieGroup;</span> </p> <p class="MsoNormal">result.setSeriesGroups(seriesGroups);</p> <p class="MsoNormal">return this.buildResponse(result);</p> </div> |
Visão Geral
Import HTML Content
Conteúdo das Ferramentas
Tarefas