user3322258
user3322258

Reputation: 1

Multiple infovis bar charts do not work

How can I have 2 bar charts plotted in 2 different divs on a single web page? If I try to do so one bar chart gets overwritten with the values of the second chart since the library looks for hardcoded div name 'infovis'. Any idea how to fix this?

Upvotes: 0

Views: 80

Answers (2)

AKDad
AKDad

Reputation: 113

I know this is a bit late, but I'd like to share what I've done.

First create two div's:

<div id='InfoVisChart1'></div>
<div id='InfoVisChart2'></div>

Then, in your JS, where you write in your code, inject into the two id's:

var barChart = new $jit.BarChart({  
//id of the visualization container  
  injectInto: 'InfoVisChart1',
.... etc.

var barChart2 = new $jit.BarChart({  
//id of the visualization container  
  injectInto: 'InfoVisChart2',
.... etc.

Works for me.

Upvotes: 1

Dominique
Dominique

Reputation: 4332

BarCharts inherit of the Canvas object, so we can make use of canvas options described here.

What you need is "injectInto": this option allows to set the ID of your container DIVs.

Upvotes: 0

Related Questions