mirror of
https://github.com/enso-org/enso.git
synced 2024-11-22 22:10:15 +03:00
Add a Visualization to the Table.Row type (#3837)
Follow up to https://www.pivotaltracker.com/story/show/182307026 When working in the IDE I noticed that the default vis is bad, so this should make it better.
This commit is contained in:
parent
f8a4e2a9d2
commit
f60e9e9d8e
@ -19,3 +19,18 @@ type Row
|
|||||||
## Gets the row as a Vector.
|
## Gets the row as a Vector.
|
||||||
to_vector : Vector
|
to_vector : Vector
|
||||||
to_vector self = Vector.from_polyglot_array (Array_Proxy.from_proxy_object self)
|
to_vector self = Vector.from_polyglot_array (Array_Proxy.from_proxy_object self)
|
||||||
|
|
||||||
|
## Converts this row into a JSON structure.
|
||||||
|
to_json : Json
|
||||||
|
to_json self = self.to_vector.to_json
|
||||||
|
|
||||||
|
## UNSTABLE
|
||||||
|
ADVANCED
|
||||||
|
|
||||||
|
Returns a Text used to display this table in the IDE by default.
|
||||||
|
|
||||||
|
Returns a JSON object containing useful metadata and previews of column
|
||||||
|
values.
|
||||||
|
to_default_visualization_data : Text
|
||||||
|
to_default_visualization_data self =
|
||||||
|
self.to_vector.to_default_visualization_data
|
||||||
|
@ -1476,3 +1476,11 @@ spec prefix table_builder test_selection pending=Nothing =
|
|||||||
table.rows (max_rows=2) . at 2 . should_fail_with Index_Out_Of_Bounds_Error_Data
|
table.rows (max_rows=2) . at 2 . should_fail_with Index_Out_Of_Bounds_Error_Data
|
||||||
table.rows . at 0 . at -4 . should_fail_with Index_Out_Of_Bounds_Error_Data
|
table.rows . at 0 . at -4 . should_fail_with Index_Out_Of_Bounds_Error_Data
|
||||||
table.rows . at 0 . at "unknown" . should_fail_with No_Such_Column_Error_Data
|
table.rows . at 0 . at "unknown" . should_fail_with No_Such_Column_Error_Data
|
||||||
|
|
||||||
|
Test.specify "should visualize nicely" <|
|
||||||
|
table.rows . to_default_visualization_data . should_equal <|
|
||||||
|
'[[1,5,"A"],[2,6,"B"],[3,7,"C"],[4,8,"D"]]'
|
||||||
|
|
||||||
|
# We limit to at most 100 rows, in the future we should add some kind of 'and N more rows' to the visualization, like is done for Table - or just integrate the lazy vis.
|
||||||
|
t2 = table_builder [["X", 0.up_to 200 . to_vector]]
|
||||||
|
t2.rows.to_default_visualization_data . should_equal (0.up_to 100 . map (x -> [x])).to_default_visualization_data
|
||||||
|
Loading…
Reference in New Issue
Block a user