javascriptjqueryhtmlhistogramprotovis

Protovis JQuery Change Histogram Xticks


I'm toying with the Protovis Histogram example and I was wondering if it was possible to change the values of the x-ticks while keeping the histogram the same. Right now the x axis varies from 0 - 5 but what if I wanted to keep the whole histogram the same but just change the x-axis ticks to vary from 10 - 15? Is that possible?

I think the change should be somewhere in the following code:

vis.add(pv.Rule)
.data(x.ticks())
.left(x)
.bottom(-5)
.height(5)
.anchor("bottom").add(pv.Label)
.text(x.tickFormat);

but I'm not really sure what the code is doing. Any help greatly appreciated. Thanks!


Solution

  • hi Michael in that link at bottom of the page you could see the code

      var experiment = {
      trials: 10000, // number of trials
      variables: 5 // number of random variables
    };
    experiment.values = pv.range(experiment.trials).map(function() {
      return pv.sum(pv.range(experiment.variables), Math.random);
    });
    

    just try to change the variables parameter to 10 or your required value. it should work..