-
KX Dashboards – Dynamically update Type of X-Axis (Number/DateTime) and using Min/Max values
Hello, is it possible in KX Dashboards to dynamically change axes from Int (Number) to dateTime?
I am looking into dynamically changing the type of the x-axis of one of my canvas charts, (from Number to Datetime) and vice versa with min/max values working correctly when populated from viewstates. For simplicity assume my output table has 3 columns: index, dateColumn, data and that the user chooses from a dropdown list widget if they want Number or Datetime type for x-axis.
So the cases are the user chooses to see their data on:
- a number x-axis of type integer ‘i’ (which gets the index position of the each row of the table – easy).
- a Date/Time x-axis of type timestamp ‘p’ (which has the datetime on each row of the table in the format “YYYY-MM-DD hh:mm:ss:SSSSSSSSS”
Case 1: Number type: When its a number, I have a separate query which takes my min/max points of the graph and expands (or contracts) the graph (given a span range from a user). This works on percentages, for example the user passes 10 as input into a text box, then the query gets the min/max values and does min-0.1*min and max+0.1*max. Then maps the output onto viewstates (call them min_x andmax_x) which are then populating the Canvas Chart’s RANGE/Use MinMax/min and max values. It all works well for the numbers!
Case 2: Datetime type: When its a Datetime type however, it seems to be buggy, it sets the minimum to be 1970 (I am guessing ‘zero’ in terms of date/time?) and the max to be the current date. When I check the min/max viewstates I can see that they are correctly poopulated with the first Datetime shown in the table’s column dateColumn and the last one to be the last entry of the column (as expected). I have even tried manipulating the column in the table and casting to “d” (for date only) to “t” (for time only) and even to “Z” (for date/time) but the canvas chart still keeps being buggy…
Please use as references the images attached – notice, in my case it should be the case where both graphs should be exactly identical, with the exception of the x-axis, one showing numbers for the indeces of the points on the table, the other one the date/time which corresponds to those points timestamps.
My question is, why could this be happening? Format of Datetime Type not matching my format from the output of the query? Or could it be min/max values for Date/time not being liked by the dashboard?
Many thanks,
SK
Log in to reply.