Visual Inspector chart question - Kx Developer 1.3.1

Hi,

Is it me, or there’s really no way to chart a typical market data timeseries without the inherent date/time gaps along the X-axis?  A 1-minute data table (with no data from 4PM to 9:30AM), as per below:

yields the following line chart:

I don’t see a way (other than than use ‘Categorical’ as X-Axis scale, in which case I loose date/time visual reference info) to get a continuous chart. 

I’m simply looking for a quick and dirty continuous time chart within Dev:-)  

Thx

Hi JP,

A couple options below might be of interest using the Grammar of Graphics library in Developer.

Starting with some market data with date/time gaps:

n:6

d:(asc 2020.12.01+neg[n]?31)+:09:00+til"j"$17:00-09:00

v:{sums count?-1 1} each d

t:ungroup (d;v)


.qp.go[600;200] .qp.line[t; d; v; ::]

One option is to use a categorical scale as you mentioned, but set the x labels explicitly to each date for reference:

.qp.go[600;200] .qp.line[t; d; v]

.qp.s.scale[`x;

.gg.scale.format[.gg.fmt.timestamp] // format the labels with newlines

.gg.scale.breaks[t[`d]{x?distinct x}`date$t`d] // extract distinct dates

.gg.scale.categorical]

Another option might be to break out each individual day into a grid of small multiples:

theme: (!) . flip (

(`title_fontsize; 12);

(`axis_tick_label_angle_x; 90);

(axis_tick_label_anchor_x; left);

(labels; x`y!(“”;“”)));


w: 800; h: 200

.qp.go[w;h]

.qp.theme[theme]

.qp.layout[`hori_p; {(x+60),(n-1)#x} (w-60)%n] { // the hori_p layout is horizontal with explicit pixel widths

.qp.title[first date$xd]

.qp.theme[``axis_use_y!(::;y~0)] // only use a y axis on the first chart

.qp.line[x; d; v]

.qp.s.share[y;y] , // make sure the y axis for the first chart can be used for every chart

.qp.s.scale[x; .gg.scale.format[{minute$x}] .gg.scale.timestamp] // display only minutes on the x axis for less noise

}'[t group date$td; til n]

Regards,

Tim

Thanks Tim for the 2 alternatives… 

Although I suspected my request could be easily fulfilled via the GoG library, I didn’t spend much time playing with it; you forced the introduction, a good thing:-)… I have to admit I am rather surprised that this basic functionality is not integrated in Visual Inspector (at least via a X-axis parameter as with Kx Dashboards) while many more less ‘simple’ visualizations are available.  Still, VI is a wonderfully useful tool for quick & basic charting.

Thanks again,

JP

| "" | Virus-free. www.avast.com |