Code Monkey home page Code Monkey logo

hana-cloud-chart's Introduction

Vaadin Charts from SAP HANA demo data

Simple Spring Boot with Vaadin application using Vaadin Charts. It's using (though not have to) SAP HANA SHINE -demo database.

Made on top of excellent sample by Matthias Steiner: https://github.com/SAP/cloud-spring-boot-sample

Running locally

mvn spring-boot:run -Drun.profiles=dev,standalone

When ran locally, a in-memory db will be used. In this case the db initialized with fraction of data from SHINE -sample database. This just to get things going locally.

Running in cloud

To create a WAR file that can be deployed to SAP HANA Cloud Platform (Tomcat 8 runtime) execute the following command:

mvn -P neo clean package install

Prerequisites for using SAP Cloud

  1. Create developer account at sap cloudplatform page
  2. After successful registration, login
  3. In SAP Cloud Platform Cockpit, create a new database:
    • Choose: Persistence/Databases & Schemas
    • Click new
    • Choose db system: HANA MDC, configure User for Shine true
    • Fill out rest to your liking (just remember those passwords :) )
    • Save
    • (Database creation takes quite some time, don't worry)
  4. Once database is up, navigate to that db and from that view, click "SAP HANA Web-based Development Workbench"
  5. If you're prompted for username-password use the ones you set in your shine -user
  6. Choose "Catalog" (There should be a screen with options: Editor, Catalog, Security, Traces)
  7. Expand Catalog and from under that you should have database (okay, not a db but catalog or schema or whatever) named as the user you made (default user was "shine", so by default the schema is "SHINE")
  8. Open SQL -console and * copy demo sales-orders from shine-demo schema

SQL for copying demo table

NOTE: if your shine user is something else than "shine", change the table prefix to match it

Create table

CREATE COLUMN TABLE "SHINE"."sales_order"(
	"SALESORDERID" NVARCHAR(10) NOT NULL,
	"HISTORY.CREATEDBY.EMPLOYEEID" NVARCHAR(10),
	"HISTORY.CREATEDAT" DATE CS_DAYDATE,
	"HISTORY.CHANGEDBY.EMPLOYEEID" NVARCHAR(10),
	"HISTORY.CHANGEDAT" DATE CS_DAYDATE,
	"NOTEID" NVARCHAR(10),
	"PARTNER.PARTNERID" NVARCHAR(10),
	"CURRENCY" NVARCHAR(5),
	"GROSSAMOUNT" DECIMAL(15, 2) CS_FIXED,
	"NETAMOUNT" DECIMAL(15, 2) CS_FIXED,
	"TAXAMOUNT" DECIMAL(15, 2) CS_FIXED,
	"LIFECYCLESTATUS" NVARCHAR(1),
	"BILLINGSTATUS" NVARCHAR(1),
	"DELIVERYSTATUS" NVARCHAR(1),
	PRIMARY KEY (
		"SALESORDERID"
	)
);

Copy data from demo

INSERT INTO "SHINE"."sales_order" (
	"SALESORDERID",
	"HISTORY.CREATEDBY.EMPLOYEEID",
	"HISTORY.CREATEDAT",
	"HISTORY.CHANGEDBY.EMPLOYEEID",
	"HISTORY.CHANGEDAT",
	"NOTEID",
	"PARTNER.PARTNERID",
	"CURRENCY",
	"GROSSAMOUNT",
	"NETAMOUNT",
	"TAXAMOUNT",
	"LIFECYCLESTATUS",
	"BILLINGSTATUS",
	"DELIVERYSTATUS"
)
SELECT
	"SALESORDERID",
	"HISTORY.CREATEDBY.EMPLOYEEID",
	"HISTORY.CREATEDAT",
	"HISTORY.CHANGEDBY.EMPLOYEEID",
	"HISTORY.CHANGEDAT",
	"NOTEID",
	"PARTNER.PARTNERID",
	"CURRENCY",
	"GROSSAMOUNT",
	"NETAMOUNT",
	"TAXAMOUNT",
	"LIFECYCLESTATUS",
	"BILLINGSTATUS",
	"DELIVERYSTATUS"
FROM "SAP_HANA_DEMO"."sap.hana.democontent.epm.data::SO.Header";

Deploying to cloud (via webpage)

In SAP Cloud Platform Cockpit:

First time:

  1. Choose Applications / Java Applications / Deploy Application
  2. Choose war-file (in target folder, named sap-hana-vaadin-chart.war)
  3. Run-time Name: Java Web Tomcat 8
  4. JVM Version: JRE 8
  5. JVM Arguments: -Dspring.profiles.active=neo
  6. Deploy (But do not start the application)
  7. Choose you database
  8. Choose "Data Source Bindings"
  9. Fill in username and password and save
  10. Start your application

If you're only updating (meaning you've done the first time already), then just update your applications by giving a new war-file and restart application.

Using

When launched, the application read all years available in database. With that info it fills the combobox. When year is chosen (first will be chosen by default) the chart will be re-drawn.

Screenshot

Using Charts

Vaadin Charts is a commercial tool - but with possibility for free open-source development - consult https://vaadin.com/charts to get a license

hana-cloud-chart's People

Contributors

mikotin avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.