11from Standard.Base import all
22
3+ import Standard.Table.In_Memory_Table.In_Memory_Table
34from Standard.Table import Column, Table
45
6+ import Standard.Database.DB_Column.DB_Column
7+ import Standard.Database.DB_Table.DB_Table
8+
59import project.Helpers
610from project.Helpers import time_visualization
711
@@ -11,7 +15,7 @@ from project.Helpers import time_visualization
1115 Gets the x column from a table.
1216 This is either the column named 'X' or the left most column.
1317x_column : Table -> Column
14- x_column table =
18+ x_column table = if table.column_count==1 then Nothing else
1519 by_name = table.get 'X' (table.get 'x')
1620 if Nothing != by_name then by_name else
1721 c = table.at 0
@@ -22,7 +26,7 @@ x_column table =
2226 private: true
2327 ---
2428json_from_table : Table -> Vector Integer | Nothing -> Integer | Nothing -> Text
25- json_from_table table bounds limit =
29+ json_from_table table bounds limit = if table.column_count==1 && table.column_names.first.equals_ignore_case "x" then json_from_table (table.rename_columns ["Value"] . add_row_number "Index" . reorder_columns ["Index","Value"]) bounds limit else
2630 ## Get the x column
2731 col_x = x_column table
2832 if Nothing == col_x then json_from_table (table.add_row_number "x") bounds limit else
@@ -93,9 +97,13 @@ json_from_vector vec bounds limit =
9397 - `value`: the value to be visualized.
9498process_to_json_text : Any -> Integer | Nothing -> Integer | Nothing -> Text
9599process_to_json_text value bounds=Nothing limit=Nothing = time_visualization Scatter_Plot ("process_to_json_text: " + value.to_display_text) <|
100+ ## If limit is Nothing will use 15,000 for in database operations
96101 json = case value of
97- _ : Table -> json_from_table value bounds limit
102+ _ : DB_Table -> json_from_table (value.read (..First (limit.if_nothing 15000))) bounds limit
103+ _ : DB_Column -> json_from_table (value.to_table.read (..First (limit.if_nothing 15000))) bounds limit
104+ _ : In_Memory_Table -> json_from_table value bounds limit
105+ _ : Column -> json_from_table value.to_table bounds limit
98106 _ : Vector -> json_from_vector value bounds limit
99- _ : Column -> json_from_table value.to_table bounds limit
100- _ -> json_from_vector value.to_vector bounds limit
107+ _ : Array -> json_from_vector value bounds limit
108+ _ -> json_from_vector value.to_vector bounds limit
101109 json
0 commit comments