jqplot същите свойства за множество графики

Въпросът е относно повторното използване на свойствата на парцела, напр.

plot_x = $.jqplot('SOMEDIVID_X', [line], {
  grid: {
        background: "rgba(0,0,0,0.0)",
        drawBorder: false,
        shadow: false,
        color: "#fff"
    },
     series:[
     {
      pointLabels:{
       show: true,
       location:'s',
       ypadding : 5,
       edgeTolerance : -100,
     }}],
    seriesColors: ["#FF666D"],
    seriesDefaults:{
        renderer:$.jqplot.BarRenderer,
        rendererOptions: {
          fillToZero: true,
          barWidth: '60'
        }
    },
    axes: {
        xaxis: {
            renderer: $.jqplot.DateAxisRenderer,
        },
        yaxis: {

            min:0,
            max:100
        }
    }
});

тази дефиниция на сюжета е прикачена към SOMEDIVID_X. Искам да използвам повторно дефиницията за подобни графики, използвайки същите свойства


person UserBSS1    schedule 21.03.2014    source източник


Отговори (1)


ето как можете да го постигнете.

var plotOptions = {
  grid: {
        background: "rgba(0,0,0,0.0)",
        drawBorder: false,
        shadow: false,
        color: "#fff"
    },
     series:[
     {
      pointLabels:{
       show: true,
       location:'s',
       ypadding : 5,
       edgeTolerance : -100,
     }}],
    seriesColors: ["#FF666D"],
    seriesDefaults:{
        renderer:$.jqplot.BarRenderer,
        rendererOptions: {
          fillToZero: true,
          barWidth: '60'
        }
    },
    axes: {
        xaxis: {
            renderer: $.jqplot.DateAxisRenderer,
        },
        yaxis: {

            min:0,
            max:100
        }
    }
};

plot_x = $.jqplot('SOMEDIVID_X', [line], plotOptions);
plot_y = $.jqplot('SOMEDIVID_Y', [line], plotOptions);
plot_z = $.jqplot('SOMEDIVID_Z', [line], plotOptions);
person Gyandeep    schedule 21.03.2014