javascriptgraphaeljustgage

How to access the value parameter of a new object created using JustGage?


I didn't go digging, because I don't think it matters what methods and so forth JustGage has, but I have this new object g.

var g = new JustGage({
    id: "gauge", 
    value: 34, 
    min: 0,
    max: 100,
});

My question is how do I retrieve the value parameter later in the script.

I thought that var value = g.value would work, but it doesn't.

Here is a bit of the justgage.js file:

 JustGage = function(config) {

  if (!config.id) {alert("Missing id parameter for gauge!"); return false;}
  if (!document.getElementById(config.id)) {alert("No element with id: \""+config.id+"\" found!"); return false;}

  var obj = this;

  // configurable parameters
  obj.config =
  {
    // id : string
    // this is container element id
    id : config.id,

    // title : string
    // gauge title
    title : (config.title) ? config.title : "",

    // titleFontColor : string
    // color of gauge title
    titleFontColor : (config.titleFontColor) ? config.titleFontColor : "#999999",

    // value : int
    // value gauge is showing
    value : (config.value) ? config.value : 0,

Solution

  • try g.config.value - from looking at the JustGage source code I think it'll be there.