2012-03-22 13 views
5

के लिए पृष्ठभूमि रंग कृपया मेरे पास एक पृष्ठ है और पेज में मेरे पास दो पाई चार्ट हैं, मैं 2 चार्ट के लिए अलग-अलग पृष्ठभूमि रंग प्रदर्शित करना चाहता हूं लेकिन यह सीएसएस फ़ाइल में एम्बेड किया गया है! क्या किसी भी रंग का उपयोग करने के लिए कोई विकल्प है ?? या इसे पारदर्शी बनाने के लिए? मेरी कोड:जेक्प्लॉट पाई चार्ट

PieTimer[index] = jQuery.jqplot(PieTimerId, 

TimerValuesArray, 
{ 
seriesDefaults: { 

shadow: false, 

seriesColors: ["#13e837", "#6e869b"], 

renderer: jQuery.jqplot.PieRenderer, 

rendererOptions: { 

highlightMouseOver: false, 

diameter: 40, 

padding: 0, 

showDataLabels: false, 

startAngle: 270, 
sliceMargin: 0, 

shadowOffset: 0, 

shadowAlpha: 0, 


shadowDepth: 0, 

drawBorder: false, 

shadow: false, 

borderWidth: 0 

} 

}, 

legend: { show: false, location: 'w'} 

} 

); 

मैं अगर मैं एक संपत्ति सेट कर सकते हैं सोच रहा हूँ (पूर्व: पृष्ठभूमि रंग ...) चार्ट ड्राइंग जब? 10x

उत्तर

21

the jqPlot options page के अनुसार आप grid नामक एक विकल्प है जहाँ आप सब ग्रिड मापदंडों सेट कर सकते हैं, इस पैरामीटर में से एक पृष्ठभूमि रंग है।

grid: { 
    drawGridLines: true,  // wether to draw lines across the grid or not. 
    gridLineColor: '#cccccc', // *Color of the grid lines. 
    background: '#fffdf6',  // CSS color spec for background color of grid. 
    borderColor: '#999999',  // CSS color spec for border around grid. 
    borderWidth: 2.0,   // pixel width of border around grid. 
    shadow: true,    // draw a shadow for grid. 
    shadowAngle: 45,   // angle of the shadow. Clockwise from x axis. 
    shadowOffset: 1.5,   // offset from the line of the shadow. 
    shadowWidth: 3,    // width of the stroke for the shadow. 
    shadowDepth: 3,    // Number of strokes to make when drawing shadow. 
           // Each stroke offset by shadowOffset from the last. 
    shadowAlpha: 0.07,   // Opacity of the shadow 
    renderer: $.jqplot.CanvasGridRenderer, // renderer to use to draw the grid. 
    rendererOptions: {}   // options to pass to the renderer. Note, the default 
           // CanvasGridRenderer takes no additional options. 
}, 

उपयोग के एक उदाहरण है:

var plot1 = jQuery.jqplot ('chart1', [data], 
{ 
    seriesDefaults: { 
     // Make this a pie chart. 
     renderer: jQuery.jqplot.PieRenderer 
    }, 
grid: { 
    drawGridLines: true,  // wether to draw lines across the grid or not. 
     gridLineColor: '#cccccc', // CSS color spec of the grid lines. 
     background: '#ffff66',  // CSS color spec for background color of grid. 
     borderColor: '#999999',  // CSS color spec for border around grid. 
     borderWidth: 2.0,   // pixel width of border around grid. 
     shadow: true,    // draw a shadow for grid. 
     shadowAngle: 45,   // angle of the shadow. Clockwise from x axis. 
     shadowOffset: 1.5,   // offset from the line of the shadow. 
     shadowWidth: 3,    // width of the stroke for the shadow. 
     shadowDepth: 3 
}, 
    legend: { show:true, location: 'e' } 
} 
); 

मुझे आशा है कि यह मदद कर सकता है!

+1

यह समाधान है, बहुत बहुत धन्यवाद। मैंने इसे एक और तरीके से किया, और यहां अगर पृष्ठभूमि एक छवि है तो यह ठीक काम करता है: रुचि रखने वाले सभी के लिए मैं जेएस फ़ाइल में बदल गया: jquery.jqplot.min.js निम्नलिखित पुराना: यह .background = "# fffdf6" नया: यह। बैकग्राउंड = "पारदर्शी" यदि हम सैंटियागो द्वारा प्रदान किए गए उदाहरण में ट्रैनपेरेंट डाल सकते हैं, तो यह भी काम करता है! धन्यवाद फिर से – HGK

+0

पुष्टि की गई: पृष्ठभूमि: 'पारदर्शी' जो आप उम्मीद करेंगे। – Tyler

+3

वितरित .js फ़ाइल को संशोधित करना स्वयं को अच्छी रखरखाव के लिए उधार नहीं देता है। मैं दृढ़ता से सुझाव देता हूं कि उस पथ का पालन न करें। सुझाव के लिए –

संबंधित मुद्दे