You could package your code as a jar and use it with %deb On Tue, Jul 21, 2015 at 7:45 PM, Wood, Dean Jr (GE Oil & Gas) < dean1.w...@ge.com> wrote:
> Hi again. > > Sorry to resurrect this but I'm only just back to looking at it, the logic > board of my computer blew. > > So are we clear that it is not possible to put this approach into a > package and have it plot a graph in Zeppelin? What is the issue? If I put > the whole lot in a html file and just have the package read the file it > plots without a problem. This is really a bit of an issue for me as a lack > of plotting capability is killing a project. > > Thanks for any further advice. > > Dean. > > Sent from my iPhone > > > On 16 Jul 2015, at 09:43, Wood, Dean Jr (GE Oil & Gas) < > dean1.w...@ge.com> wrote: > > > > Awesome. Thank you very much. I am basically learning html and D3 as I > go here so I was sure there were stupid mistakes all over the place. I > really appreciate your time and effort. > > > > Dean > > > > Sent from my iPhone > > > > On 16 Jul 2015, at 07:45, Corneau Damien <cornead...@gmail.com<mailto: > cornead...@gmail.com>> wrote: > > > > Hi, > > > > I solved your problems, you can check it out here: > https://beta.zeppelinhub.com/#/notebook/dcorneau/2AW72S1F8< > https://urldefense.proofpoint.com/v2/url?u=https-3A__beta.zeppelinhub.com_-23_notebook_dcorneau_2AW72S1F8&d=AwMFaQ&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI&r=C6rdvMYZDOvgGg5mqGWcidO2RK8DHopadY7gNniB1Do&m=3at59y19wZg8bfrUkTtqARHxgdeK32Rx5MXnzU3oe1k&s=zrP5lGev7a1-qt_xRhWwJV_YNtkcPzG4Sm6w8ovUAOM&e= > > > > > > It took me some time because the package definition doesn't work in > zeppelin (seems related to REPL) > > > > Basically your file1.html had some problems: > > - there was a <body> tag not closed > > - there was a <meta> tag (it would work, but only on HTML5 webbrowser) > > > > The body tag was the main reason. > > When you try to add an html like that, keep in mind that it is injected > in the Zeppelin, and it already has a body. > > So just inject a <div> instead > > > > I also added the size in the svg declaration (otherwise the size is > random, especially height) > > > > > > > > On Thu, Jul 16, 2015 at 4:43 AM, Wood, Dean Jr (GE Oil & Gas) < > dean1.w...@ge.com<mailto:dean1.w...@ge.com>> wrote: > > Hi Moon, > > > > Thanks for the quick response. My problem with my approach is it doesn’t > work. When I package it up and then call it from zeppelin with > > { > > import zep_plot._ > > zep_plot.zepplot.plotter > > } > > > > it prints out the html and doesn’t display the plot. What am I doing > wrong? > > > > Dean > > > > On 15 Jul 2015, at 19:23, moon soo Lee <m...@apache.org<mailto: > m...@apache.org><mailto:m...@apache.org<mailto:m...@apache.org>>> wrote: > > > > Hi, > > > > Will String interpolation helps? > > http://docs.scala-lang.org/overviews/core/string-interpolation.html< > https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.scala-2Dlang.org_overviews_core_string-2Dinterpolation.html&d=AwMFaQ&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI&r=C6rdvMYZDOvgGg5mqGWcidO2RK8DHopadY7gNniB1Do&m=3at59y19wZg8bfrUkTtqARHxgdeK32Rx5MXnzU3oe1k&s=Cnpuera9uaj7VlB3pxZX-Beh5r6oDRD3sJ7FRdoTIFc&e= > >< > https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.scala-2Dlang.org_overviews_core_string-2Dinterpolation.html&d=AwMFaQ&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI&r=C6rdvMYZDOvgGg5mqGWcidO2RK8DHopadY7gNniB1Do&m=oRx08Hd5OBzshoEajYJT44kf-EV_fqt5gW9SKBrz4bc&s=7HA__qeQYwCXi10qhnEbdOR4F341jQwSRJLoULEV2RM&e= > > > > > > And i think your approach is very valid. > > > > Best, > > moon > > > > On Wed, Jul 15, 2015 at 8:31 AM Wood, Dean Jr (GE Oil & Gas) < > dean1.w...@ge.com<mailto:dean1.w...@ge.com><mailto:dean1.w...@ge.com > <mailto:dean1.w...@ge.com>>> wrote: > > Hi, > > > > I’m having some issues with getting a html file which plots a line graph > using D3 to plot using some scala variables. My html is rubbish so it might > be something straightforward. > > > > I have a simple package built with sbt containing the following: > > package zep_plot > > > > import com.google.common.io.Files > > > > > > package object zepplot{ > > def plotter():Unit= { > > val x1=Vector(0, 1, 2, 3, 4) > > val y1=Vector(0, 1, 2, 3, 4) > > val x2=Vector(0, 1, 2, 3, 4) > > val y2=Vector(0, 1, 4, 9, 16) > > val text1 = com.google.common.io.Files.toString(new > java.io.File("/Users/deanwood/Documents/scala/plot/src/main/scala/file1.html"), > com.google.common.base.Charsets.UTF_8) > > val text2 = com.google.common.io.Files.toString(new > java.io.File("/Users/deanwood/Documents/scala/plot/src/main/scala/file2.html"), > com.google.common.base.Charsets.UTF_8) > > println("%html"+ text1 + x1(0) +","+x1(1) +","+x1(2) +","+ x1(3) > +","+ x1(4) + "], y: ["+ y1(0) +","+y1(1) +","+y1(2) +","+ y1(3) +","+ > y1(4) + "] }, { label: \"Data Set 2\", x: ["+ x2(0) +","+x2(1) +","+x2(2) > +","+ x2(3) +","+ x2(4) + "], y: ["+ y2(0) +","+y2(1) +","+y2(2) +","+ > y2(3) +","+ y2(4) + text2) > > } > > } > > > > > > I’ve broken the html file in two and tried to replace the part where I > inserted the data in the javascript with variables defined in scala on > zeppelin. I’ve attached the html below. > > > > The ultimate aim is to be able to provide some standard plots which will > dynamically take RDDs defined in zeppelin and plot them with enhanced plots > not currently provided by zeppelin. The aim is have an interim fix until > the mooted summer of code project hopefully enhances zeppelins plotting > capability. So, to make this interim solution work, how do I get scala > variables plotted in the javascript of a html file. I’d like the info on > how to use the variables as I want to do the same thing for a heat map and > a couple of other standard plots required for my project. I’ve attached the > example html files used in the scala package below. > > > > Thanks for any help. > > > > Dean > > > > > > >