Zeplin is a connected workspace where you can share, organize and collaborate on designs — built with developers in mind. Apache Zeppelin is a web-based notebook that enables interactive data analytics. With Zeppelin, you can make beautiful data-driven, interactive and collaborative documents with a rich set of pre-built language back-ends (or interpreters) such as Scala (with Apache Spark), Python (with Apache Spark), SparkSQL, Hive, Markdown, Angular, and Shell. Zeppelin angular-tricks. GitHub Gist: instantly share code, notes, and snippets. Zeplin Extensions Get more out of Zeplin, together. Extensions are built by the community to generate code snippets from designs. Pick the ones that fit your workflow, or create your own and contribute. Angular (a Javascript-based system) code can be used to display data. The data is stored in the global variable z, which is a ZeppelinContext. Z is shared by angular and the%spark variants. You'll need to put the data to be displayed into z using z.put(attribute, value), where attribute is a string.
- Zeppelin Angular Core
- Zeppelin Angular
- Zeppelin Angular Font
- Zeppelin Angular Tutorial
- Zeppelin Angular Download
In Zeppelin Maps the Easy Way I showed how to add a map to Zeppelin with a Helium module. But what if you do not have access to the Helium NPM server to load in that module? And what if you want to add features to your Leaflet Map that are not supported in the volume-leaflet package?
This will show you how the Angular javascript library will allow you to add a map user interface to a Zeppelin paragraph.
First we want to get a map on the screen with markers.
In Zeppelin create a new note.
As was shown in How to Use Zeppelin With SAP HANA we create a separate paragraph to build the database connection. Please substitute in your own database driver and connection string to make it work for other databases. There are other examples where you can pull in data from a csv file and turn it into a table object.
Zeppelin Angular Core
In the next paragraph we place the spark scala code to query the database and build the markers that will be passed to the final paragraph which is built with angular.
The data query paragraph has a basic way to query a bounding box. It just looks for coordinates that are greater and less than the northwest and southeast corners of a bounding box.
var sql1 = 'select comments desc, lat, lng from EVENT_VIEW '
if (box.length > 0) {
var coords = box.split(',')
sql1 = sql1 + ' where lng > ' + coords(0).toFloat + ' and lat > ' + coords(1).toFloat + ' and lng < ' + coords(2).toFloat + ' and lat < ' + coords(3).toFloat
}
var sql = sql1 +' limit 20'
val map_pings = jdbcDF.sqlContext.sql(sql)
z.angularBind('locations', map_pings.collect())
The data from this query is used to make the map_pings and bind it to angular so that any angular code can reference it. Zeppelin has the ability to bind data into other languages so it can be used by different paragraphs in the same note. There are samples for other databases, json and csv files at this link.
We do not have access to the Hana proprietary functions because Zeppelin will load the data up in its own table view of the HANA table. We are using the command “createOrReplaceTempView” so that a copy of the data is not made in Zeppelin. It will just pass the data through.
Note that you should set up the HANA jdbc driver as described in How to Use Zeppelin With SAP HANA.
It is best if you set up a dependency to the HANA jdbc jar in the Spark interpreter. Go to the Zeppelin settings menu.
Zeppelin Settings Menu
Pick the Interpreter and find the Spark section and press edit.
Then add the path you where you have the SAP HANA jdbc driver called ngdbc.jar installed.
Configure HANA jdbc in Spark Interpreter
First Paragraph
Second Paragraph
Third Paragraph
Zeppelin Angular
In the third paragraph we add the angular code with the %angular directive. Note the for each loop section where it builds the markers and adds them to the map.
Now when you run the three paragraphs in order it should produce a map with markers on it.
The next step is to add a way to query the database by drawing a box on the screen. Into the scala / spark code we add a variable for the bounding box with the z.angularBind() command. Then a watcher is made to see when this variable changes so the new value can be used to run the query.
Modify Second Paragraph
To the angular section we need to add in an additional leaflet library called leaflet.draw. This is done by adding an additional css link and a javascript script. Then the draw controls are added as shown in the code below.
Zeppelin Angular Font
Modify the Third Paragraph
There are some important features to mention here that took some investigation to figure out.
Within Zeppelin I was unable to get the box being drawn to be visible. So instead drawing a box will the map to zoom to the area selected by utilizing this code:element.val(layer.getBounds().toBBoxString());
map.fitBounds(layer.getBounds());
To make the map zoom back to the area after the query is run this code is triggered.
$scope.latlng.push(L.latLng(event.values[1], event.values[2]))
...
var bounds = L.latLngBounds($scope.latlng)
map.fitBounds(bounds)
To trigger the spark / scala paragraph to run after drawing a box this code causes it to run the query paragraph:></input>
The html form at the bottom is what holds and binds the data back and forth between the paragraphs. It is visible for debugging at the moment.
Please let us know how it works out for you. Hopefully this will help you add maps to your Zeppelin notebook. I am sure there are many other better ways to accomplish this feature set but this is the first way I was able to get it all to work together.
Demo of the interface:
You can contact us using twitter at @volumeint.
Some code borrowed from: https://gist.github.com/granturing/a09aed4a302a7367be92 and https://zeppelin.apache.org/docs/latest/displaysystem/front-end-angular.html
Zeppelin Angular Tutorial
Connected Components in Zeplin enables engineers to access components in their codebase right on the designs.
After connecting your components in Zeplin to your components in code, you will be presented with a summary of the component,includinglinks to Storybook, GitHub, and any other source of documentation used by your team.
This summary is completely flexible and can be tailored to your team’s needs. You can customize the description, the code snippet and add links to any source like your internal wiki or your design system documentation.
With Connected Components, you can:
Zeppelin Angular Download
Connect your React components, Angular components, Swift components and Vue.js components to your components in Zeplin.
Add Storybook links, Styleguidist links, repository links (GitHub, GitLab, Bitbucket) and any other custom links to your design system documentation.
Connecting your first component
Getting started is easy. Zeplin maps components in your codebase to the components in Zeplin with a JSON configuration file. First, you need to create this file manually or by using the Zeplin Visual Studio Code extension.
After creating the configuration file, you’ll need to install Zeplin CLI and run it by using zeplin connect command to make these connected components visible in Zeplin
☝️ Zeplin CLI is a command line tool that uses plugins to generate documentation, snippets and links from components. You can use Zeplin CLI with these plugins; React Plugin, Angular Plugin, Swift Plugin, Storybook Plugin and Vue Plugin.
Follow the step by step guide to get started: https://github.com/zeplin/connected-components-docs
Related articles: