-
Notifications
You must be signed in to change notification settings - Fork 63
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
Improve experience with HTML rendering of dataframes #300
Conversation
*/ | ||
public fun <T> DataFrame<T>.toStandaloneHTML( | ||
configuration: DisplayConfiguration = DisplayConfiguration.DEFAULT, | ||
cellRenderer: CellRenderer = org.jetbrains.kotlinx.dataframe.jupyter.DefaultCellRenderer, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I think our idea was to move everything Jupyter into a separate module, right? I think we should have a Jupyter-less toHTML method :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thing is, this is our class :) I was confused too. The idea was to move Integration to another module, so we cannot accidentally use something that is not available outside notebooks. I think this one is ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh hmm, odd XD. Then it could be fine for now I think. As long as we take up #241 in the future :)
Can we please, please just make Before 8e596e6 it was just a boolean named
And the thing is, I can't think of a use case where P.S. How can I make code suggestions? Should I make a PR against this PR branch or something? |
Hi! Sorry for the inconvenience, it was indeed overlooked. With this PR |
@koperagen Thanks for quick reply. Yes, I've seen that
I've started to use Back to the topic, can we maybe than rename parameter |
Oh, okay, thank you for your perspective. I wasn't sure if we should create our own public version of HtmlData, but now i see that we should. For external use, it looks like |
Right, that's the only things dataframe's HtmlData had and the only ones I use.
Now I feel bad if public version will be created only because of me. Maybe what I do is too much special and could/should be done otherwise. I just do a little tweaking, for example I want to align everything right, not just numbers, so I have private fun HtmlData.alignAllRight() = this + HtmlData("""
table.dataframe th, td {
text-align: right;
}
""".trimIndent(), "", "") but that is bad example, because it could be done with private fun HtmlData.addExpandAllColumnsFunction() = this + HtmlData("", "", """
function expandAllColumns() {
const tableRootId = document.getElementsByClassName('dataframe')[0].df.rootId;
const dframe = document.getElementById("df_" + tableRootId).df;
dframe.cols.forEach((col) => {if (col.children.length > 0) col.expanded = true});
for (frameId in dframe.childFrames) dframe.childFrames[frameId].cols.forEach((col) => {if (col.children.length > 0) col.expanded = true});
DataFrame.renderTable(tableRootId);
}
""".trimIndent())
private fun HtmlData.expandAllColumns() = addExpandAllColumnsFunction() + HtmlData("", "", """
expandAllColumns();
""".trimIndent()) and similar to expand all nested frames. At the end I display it in JavaFx WebView, so I can even interact with it if needed and call javascript functions from kotlin. |
Hi @pacher i published this draft as a dev version |
@koperagen Couple of remarks:
|
Thanks! I checked that |
Path claims it has better platform independence, unicode support and better performance, so people might have reason to choose it over File
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/Integration.kt
Outdated
Show resolved
Hide resolved
docs/StardustDocs/topics/toHTML.md
Outdated
|
||
### Configuring display for individual output | ||
|
||
`toHTML` is useful if you want to configure display for single cell, not whole notebook as described in section for [Jupyter Notebooks](jupyterRendering.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grammar ;P
configure how a single cell is displayed. How to configure this for the entire notebook, check out this section..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thanks for pointing that out. I rephrased this sentence
In this PR i'll to address issues that exist with our HTML rendering