Ejemplos de charts con sapui5

Hola comunidad. Ya es Febrero y se está pasando el tiempo muy rápido. Este es el primer momento que tengo desde el inicio del año para escribir mi primer blog del ’18 – vea tmb la version en Ingles del mismo . Decidí escribir este blog debido a que en mi blog anterior, mi amigo Mustafa Bensan me recomendó ver los ejemplos de la libreria de charts en sapui5.

Mi primer instinto cuando empiezo a trabjar con una libreria nueva es usualmente, leer ejemplos, copiarlos a mi proyecto y modificarlos para ver como se compara con otras experiencias anteriores.

Como alomejor ya saben, el setup inicial de un proyecto de tipo sapui5 – pueden ver esos pasos aquí – una vez que tengas un archivo html en blanco, un view, controller y model… vamos a empezar a construir este ejemplo.

Asegurate de que incluyas la referencia a la lib durante el bootstrap en tu html. ** Me molesta mucho ver algo de estos errores de lenguage, libreries pre-load, asi que aqui también les va un bonus para su prox proyecto en sapui5**

Una vez que tengas el set up inicial … entonces veamos al view en xml. Copie el ejemplo de la documentación originalmente con un chart de columnas, luego uno con barras, lineas, y finalmente uno en forma de pie… hay otros, sin embargo, después de los 1os 2, se darán cuenta que hay mucha repetición entre uno y otro.

En la sig. imagen, pueden ver la propiedad vizType para cambiar el tipo de chart

Siguientemente, en mi controller, veamos:

* agarra el objecto de tu chart en el metodo, onAfterRendering, pues no estará listo en el metodo onInit todavía)

* Puedes mostrar (cuando pones el mouse sobre la medida) un toolTip que se crea usando JavaScript y luego conectandolo al chart, o

*(código comentado)  puedes mostrar un Popover que muestra las medidas una vez que el usuario da un click en la medida.

Finalmente, puedes observar que los charts Viz comparten propiedades similares:

* Chart Title – sale uno por default, pero se puede esconder o cambiar el texto
* Axis/Category Labels muestra/esconde, formatea
* Legend – las etiquetas de las dimensiones
* otros…

Después de guardar, los charts se veen mas o menos asi

en Dónde más debes de poner atención?
cuando hagas el set up del chart de tipo pie

Recuerda, que los ids  de los controles deben de ser unicos (como estaba copiando el codigo de un chart para el otro, vi varios errores)

Si necesitas mostrar un tooltip o un popover, ve como se ven de las dos formas

Tooltip ejemplo con javascript desde el controller – luego tienes q conectarlo al chart viz.
Popover, el ejemplo mio tiene el codigo en el view xml, luego desde el controller, para poder conectarlo al chart

Otras cosas que no incluí en este blog pero serian buenas para tratar::

* Cambiar el color de las medidas (static)
* Añadir logica para mostrar el color de las medidas basadas en alguna condición, etc.

Palabras finales:

Los ejemplos del sitio de sapui5 tienen mucha documentación buena, pero, desafortunadamente, la parte que no se ve completa es la parte de las propiedades del objecto VizProperties. (solo muestra una)

Tuve que buscar en varias sesiones de google y de otros ejemplos en la misma parte de la documentación para ver ciertas propiedades. Estaría mejor si en el API, puedieramos encontrar una lista completa de las mismas en un solo lugar.

Los charts de la libreria Viz chart son muy poderosos y lo mejor de todo es que son parte del sapui5 sin tener que bajar nada mas – solo hay q incluirla en el bootstrap. Espero poder usarla en mi prox proyecto de sapui5.

Comparte tus comentarios y gracias por leer. Feliz fin de semana! http://bit.ly/2F9kaVA #SAP #SAPCloud #AI

Technology has to follow your data strategy

Knowledge is power

Knowledge is power. With IDC estimating that the data mountain has now reached five zettabytes, it is not a case of a business not having enough data to make business decisions, but arguably knowing too much. For many, it is the old adage of not being able to see the wood from the trees. Armed with all this information, businesses should be able to operate more efficiently and accurately than ever before, but many simply don’t have the key to unlock valuable insights from the data.

Data science technology is evolving to allow companies to create insights, predictions and automated prescriptions out of the growing data mountain. Yet, it is not a case of one size fits all. The technology needs to be available in everything from a free downloadable solution for developers to play around with on their laptops, to high-performance on-premise systems that can be housed in an organisation’s secure data centre.

They want answers

The highly-regarded 2018 Global Dresner Market Study for Analytical Data Infrastructure (ADI) revealed that on-premises deployments of ADI platforms was leading in priority over cloud deployments but that the deployment option varies wildly by use case. It did, however, note that respondents’ priority for hybrid deployment (a mix of on-premise and cloud) has increased year-on-year.

Wherever the ADI platform is deployed, one thing that all respondents agreed upon is that performance is a top priority for any embedded analytics. This is not surprising. Businesses today operate in rapidly shifting marketplaces, so agility is imperative to not just surviving, but thriving. To facilitate this, they not only want answers, but want them now.

The other consideration respondents cited for an ADI platform is its inherent security. With the EU General Data Protection Regulation (GDPR) just around the corner, the consequences of not properly securing data are bigger than ever. Due to come into force May 2018, the GDPR will mean that firms that suffer a subsequent data breach could face a potential fine of €20m or 4% of annual turnover – whichever is greater.

Horses for courses

While the popularity of the cloud has gathered pace in recent years, it is still horses for courses. Each organisation is different. Whether they prefer to host their data on-premise, in a private cloud, public cloud or prefer a hybrid solution, organisations need the right architecture for their specific data eco system. It should facilitate data storage, standard reporting and data processing, artificial intelligence and a flexible way of adjusting to future trends in an open, extensible platform.

With the siloed nature of data, the likelihood is that it will increasingly reside both on-premise and in the cloud. Therefore, it is important for businesses to be able to integrate and transparently access data sources in such hybrid environments. They need a solution that will allow them to set up one database cluster in the cloud, another one on-premise and connect both systems using virtual schemas, so that they have a 360-degree view of their data.

Tapping into insight

ADI is becoming a significant topic within business intelligence and analytics. Businesses have woken up to the fact that there is value in their data. We are now seeing organisations move to a place where business-oriented data strategies are a major focus. With that shift comes the need for sophisticated data science approaches that deliver swift results back to the business. With the right tools, they can tap into insight that improves their customer offerings, streamline business processes or reduce costs.

To better compete, businesses need to be proactively reactive. They are moving from an era of descriptive (looking at past trends), to predictive (looking to the future) and even to prescriptive (finding the best course of action to meet key performance indicators). To facilitate this, businesses need a powerful combination of the latest artificial intelligence tools and standard SQL analytics to create more agility and efficiency in finding the right insights out of data. The good news is that there are now platforms available that combine any data science language within the same system and combine it with standard database technologies.

Don’t leave your data behind

Savvy organisations today are transforming how they use their data, to unlock the power within. Whether that’s a multi-national retail business bringing together disparate data sources to mine for actionable insights to drive profitability, or a hand-to-mouth charitable organisation wishing to spot trends that could ultimately save lives.

As more and more organisations move towards a hybrid cloud concept that combines on-premise systems with public cloud deployments into one seamless IT landscape, it is important that they don’t leave their data behind. It is time for businesses to make an about turn and ensure that technology follows their data strategy, not the other way around. https://goo.gl/RHRWfG #DataScience #Cloud

5 Pro-Tips For Data Scientists To Write Good Code

Use Version Control

This is important for both collaboration and backups. It allows us to track the changes to a project as it undergoes development, useful for coordinating tasks and encouraging due diligence. Git is a powerful version control software, with the ability to branch parts of the development, track and commit changes, push and fetch from remote respositories, and merge code pieces together overcoming conflicts as necessary .

Make it Readable

A key component of collaborative coding is the ability to hand it over to other developers for review and use, meaning it has to be readable. This includes using appropriate variable and function names with explanatory comments where necessary, and regular inclusion of docstrings that introduce the piece of code and its details. It is also important to follow the relevant style guide for the language you’re using, e.g., PEP-8 in Python 

Keep it Modular

When writing code it’s important to keep it modular.That is, to break it up into smaller pieces that execute separate tasks as part of the overall algorithm. This level of functionality makes it easy to:

* control the scoping of variables,
* reuse modules of code,
* refactor code during further development,
* read, review and test code.

Write Unit Tests

A unit test generally exercises the functionality of the smallest possible unit of code (which could be a method, class, or component) in a repeatable way. For example, if you are unit testing a class, your test might check that the class is in the right state. Typically, the unit of code is tested in isolation: your test affects and monitors changes to that unit only. Ideally this forms part of a “Test Driven Development” framework for encouraging that all pieces of software are fully reviewed and tested before being integrated or deployed,minimizing time spent refactoring and debugging later on.

Code for Production

Try to write your code as if you’re putting it into production. This will form good habits as well as make it easy to scale-up when it inevitably (hopefully) does go into production.

Consider “algorithm efficiency” and try to optimise to reduce runtime and memory use. “Big-O notation” is important here .

Also consider your code environment or ecosystem and avoid dependencies by, e.g., virtualisation either at the code level (e.g.Python virtualenv) or at the operating system level (e.g.Docker containers).

Production level code should also employ “logging” to make it easy to review, inspect and diagnose issues when executing the code.

Follow me on twitter: @datascienceuni  and here https://goo.gl/A8aQ3q #DataScience #Cloud