-
Notifications
You must be signed in to change notification settings - Fork 646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: make tech.tablesaw.plotly.Plot members public #860
Comments
You just need them to be |
Yes, that is correct. |
The private methods are now protected (on master. not sure when they'll be in a release version). Not sure what you mean by
It takes a file now for the output. What is it you would like to see changed. |
@lwhite1 Thank you. Currently you have: public static void show(Figure figure, String divName, File outputFile) {
...
} which creates the HTML page for a single figure with the public static void show(String HTML, File outputFile) {
...
} I could use that. Note that I said refactor because I public static void show(output: String, File outputFile) {
try {
try (Writer writer =
new OutputStreamWriter(new FileOutputStream(outputFile), StandardCharsets.UTF_8)) {
writer.write(output);
}
new Browser().browse(outputFile);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
public static void show(Figure figure, String divName, File outputFile) {
Page page = Page.pageBuilder(figure, divName).build();
String output = page.asJavascript();
show(output, outputFile);
} Ofcourse I don't know if this fits in ok with what you have planned here, |
It's possible to create your own html to display more than one image.
You can find the example code in the jsplot test directory as:
tech.tablesaw.examples.MultiPlotExample
…On Mon, Jan 25, 2021 at 3:51 AM hmf ***@***.***> wrote:
@lwhite1 <https://github.com/lwhite1> Thank you.
Currently you have:
public static void show(Figure figure, String divName, File outputFile) {...
}
which creates the HTML page for a single figure with the divName.
I create an HTML page with several figures and would like to show that.
So it is not possible for me to take that HTML and show it. However if you
had a protected member:
public static void show(String HTML, File outputFile) {...
}
I could use that. Note that I said refactor because I
think that that call can be reused by your own class:
public static void show(output: String, File outputFile) {
try {
try (Writer writer =
new OutputStreamWriter(new FileOutputStream(outputFile), StandardCharsets.UTF_8)) {
writer.write(output);
}
new Browser().browse(outputFile);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
public static void show(Figure figure, String divName, File outputFile) {
Page page = Page.pageBuilder(figure, divName).build();
String output = page.asJavascript();
show(output, outputFile);
}
Ofcourse I don't know if this fits in ok with what you have planned here,
but I don't think it will affect the current API.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#860 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA2FPASQLVSJFZC5V7LO3WLS3UWHXANCNFSM4WCODENA>
.
|
I understand. I have used that for my own code so: val page = HTMLPlot.makePage(List(figure1, figure2), List(funcInfo.divName, gradInfo.divName))
HTMLPlot.show(page, HTMLPlot.withName(funcInfo.divName)) I had to code my own Not a big issues. But it will save people from explicitly adding code to save the HTML to a file and then opening a browser to load that file. As I said, no biggy. Please feel free to close this issue. Thank you |
i will take a look when i have some time. |
implemented. |
Would it be possible to make the class have its private members public. This way I can extend the plot class for additional functionality. It would also be great to refactor the
show
to use ashow(String html, File outputFile)
that saves the HTML to a file, so that it can be reused for other page set-ups.The text was updated successfully, but these errors were encountered: