From f114f1fa054abc73b75e0b89c7348545a91762ff Mon Sep 17 00:00:00 2001 From: Yannick Assogba Date: Thu, 19 Sep 2019 13:30:38 -0400 Subject: [PATCH] update barchart & histrogram tooltips --- tfjs-vis/src/render/barchart.ts | 9 ++++++--- tfjs-vis/src/render/histogram.ts | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tfjs-vis/src/render/barchart.ts b/tfjs-vis/src/render/barchart.ts index c74dd7c2dd1..3e3f80e972f 100644 --- a/tfjs-vis/src/render/barchart.ts +++ b/tfjs-vis/src/render/barchart.ts @@ -101,7 +101,10 @@ export async function barchart( } }, 'data': {'values': values, 'name': 'values'}, - 'mark': 'bar', + 'mark': { + 'type': 'bar', + 'tooltip': true, + }, 'encoding': { 'x': {'field': 'index', 'type': xType, 'axis': xAxis}, 'y': {'field': 'value', 'type': yType, 'axis': yAxis} @@ -124,8 +127,8 @@ const defaultOpts = { fontSize: 11, }; -// We keep a map of containers to chart instances in order to reuse the instance -// where possible. +// We keep a map of containers to chart instances in order to reuse the +// instance where possible. const instances: Map = new Map(); diff --git a/tfjs-vis/src/render/histogram.ts b/tfjs-vis/src/render/histogram.ts index cfea2f7666b..2096675ce6e 100644 --- a/tfjs-vis/src/render/histogram.ts +++ b/tfjs-vis/src/render/histogram.ts @@ -95,7 +95,10 @@ export async function histogram( 'resize': true, }, 'data': {'values': filtered}, - 'mark': 'bar', + 'mark': { + 'type': 'bar', + 'tooltip': true, + }, 'config': { 'axis': { 'labelFontSize': options.fontSize,