Questions tagged [vega-lite-api]

23 questions
3
votes
1 answer

How to use field value as a color value in vega lite pie chart?

I came across this pie chart vega lite visualization: { "$schema": "https://vega.github.io/schema/vega-lite/v5.json", "description": "A simple pie chart with labels.", "data": { "values": [ {"category": "a", "value": 4}, …
MsA
  • 2,599
  • 3
  • 22
  • 47
2
votes
1 answer

How to dispatch vega-lite events from JavaScript

I am trying to emulate vega-lite events to trigger interactions on charts manually through javascript. I am able to dispatch events and get them to be reconized by the listner, however the event doesn't register any items and does not trigger the…
1
vote
1 answer

Vega-Lite doesn't display numbers correctly in stacked bar chart on y axis

For some reason, my stacked bar chart doesn't display the numbers correctly on Y axis. I checked data format, tries different ones, but they are all rounded up as 0.0, 0.1 etc My min value is 500,000 and max value is 272M. Where to look for a…
Chique_Code
  • 1,422
  • 3
  • 23
  • 49
1
vote
1 answer

Achieving custom tooltip containing multiple columns in vega-lite

I am able to prepare following visualization with vegalite: The code for this visualization looks like following: { "width": 400, "config": {"view": {"continuousWidth": 600, "continuousHeight": 300}}, "data": { "values": [ {"title":…
MsA
  • 2,599
  • 3
  • 22
  • 47
1
vote
1 answer

Vega lite: Add Total Column to Table Visual

Here is my…
Tyvain
  • 2,640
  • 6
  • 36
  • 70
1
vote
0 answers

Cannot impute missing values

Have this image Given this vega-lite { "$schema": "https://vega.github.io/schema/vega-lite/v5.json", "data": { "values": [ { "timestamp": "2011-04-01T17:06:21.000Z", "value": 0.44777528325189986 }, { …
Connor
  • 4,216
  • 2
  • 29
  • 40
1
vote
1 answer

Unable to embed vega-lite visualization in react

I am trying to use vega-lite in react. I tried below (check on codesandbox) and its working: Attempt 1 - data hardcoded in spec (working) radialChart.js import { createClassFromSpec } from "react-vega"; export const RadialChart =…
Mahesha999
  • 22,693
  • 29
  • 116
  • 189
1
vote
1 answer

How to translate mean aggregation vega-lite grammar to vega-lite-api code

I was trying to learn vega-lite-api. I came across this vega-lite example: { "data": {"url": "data/cars.json"}, "mark": "bar", "encoding": { "x": {"field": "Cylinders"}, "y": {"aggregate": "mean", "field": "Acceleration"} } } It…
Mahesha999
  • 22,693
  • 29
  • 116
  • 189
0
votes
1 answer

custom labels on x axis

I am trying to put labels on x-axis but I am getting 'undefined'. this is what i achieve so far: flatten not working, I tried separate flatten as well as one array. I need replace density values with labels. Any help appreciated. { "$schema":…
newDev
  • 45
  • 4
0
votes
2 answers

Vega expression debug messages in Kibana

I cannot seem to get debug messages to show up in vega in kibana. The docs say I can use the functions warn(), info(), and debug() in expressions and they will print to the console which I assumed is the browser developer console. I cannot get these…
Currn Hyde
  • 57
  • 5
0
votes
1 answer

How to add additional data to Vega lite tooltip?

I'm trying to add an additional value (in this case z) to the tooltip. How can I achieve this with the following schema I have so far? I know it should be along the lines of adding additional objects to the tooltip array (one for last month and one…
0
votes
1 answer

The Vega-lite x-axis displays the specified number of data

Here is my generated pic, my x-axis is too large, so if I wanna display specified number, how can I fix my code? I tried to cut my data source from ES DSL as my breakthrough point, but cumulative_sum needs complete data source. { "$schema":…
John
  • 23
  • 4
0
votes
1 answer

How to use sequential schemes in vega-scale api with linear or log scale

In our project we are using vega-scale to generate heatmaps for numeric data. We managed to use a sequential scheme like viridis with scale = vega.scale('sequential').interploate(vega.scheme('viridis'));. I can't seem to figure out from the…
fxwiegand
  • 1
  • 2
0
votes
0 answers

In Vega Lite, is there a way to lock the axis while using pan and zoom so they don't go beyond the domain of your data?

I have a pretty standard pan and zoom function in my vega lite set up: const brush = vl.selectInterval().bind('scales').encodings("x").clear('dblclick') I was just wondering if there was sa way to lock the x axis so that you couldn't pan outside of…
0
votes
1 answer

Scaling x-axis to fit the box in vega lite

I tried line chart and bar chart stacked one above other in VegaLite. Initially, I tried in VegaLite API as follows: const d_pdf_plot = vl.markBar({ color: '#4c78a8' }) //'#007ddc' .data(data1) .encode( vl.y() …
MsA
  • 2,599
  • 3
  • 22
  • 47
1
2