MENU
.net Powerful JavaScript charts
About
RGraph is a JavaScript charts library based on HTML5 SVG and canvas. RGraph is mature (over 15 years old) and has a wealth of features making it an ideal choice to use for showing charts on your website.

More »

 

Download
Get the latest version of RGraph (version 6.18, 1st June 2024) from the download page. You can read the changelog here. There's also older versions available, minified files and links to cdnjs.com hosted libraries.

More »

 

License
RGraph can be used for free under the GPL or if that doesn't suit your situation there's an inexpensive (£129) commercial license available.

More »

I have an error with my SVG chart: attribute d - expected number


Posted by Todd Shafer at 14:15 on Friday 18th March 2022 [link]
Hello again, sorry to bug you. I updated to your newest code and I have one graph I can't get to work on, which works in the old code. Can you tell me what this error means?

Error: <path> attribute d: Expected number, "?.69266055045871 null L64.9235474?".
RGraph.svg.common.core.js:191 Error: <path> attribute d: Expected number, "?.69266055045871 null L64.9235474?".

I've checked the data and there are no null values. This was a graph you helped me with years ago. Below is the code:

line = new RGraph.SVG.Line({
id: 'cc1',
data: [2012.06,3513.5,3521.87,-4505.13,-2311.93,751.82,2945.02,-807.98,-2663.98,-579.73,-9642.73,-9387.45,-8481.37,-7892.87,-7310.07,-9012.07,-12016.07,-12016.07,-11142.37,-10485.86,-9809.54,-8572.18,-12999.18,-12416.38,-16257.38,-12907.59,-12907.59,-17571.59,-20964.82,-22703.82,-22695.45,-25785.7,-21430.05,-20833.18,-20027.88,-18785.9,-17197.8,-14733.25,-14271.21,-16365.21,-14036.64,-12009.42,-12990.42,-10519.63,-8754.1,-8754.1,-1594.61,2115.93,957.93,2483.33,1707.33,1713.03,-2072.97,447.5,-4158.5,-4516.79,-4254.6,-4254.6,-3593.2,-3593.2,-5907.56,-4894.77,-2203.76,267.02,4733.83,8581.83,782.23,852.97,-1595.55,-1295,-1275.23,672.17,2612.18,4628.95,5250.48,-1135.52,-2215.83,-1954.14,-1974.45,1736.09,4540.28,5816.43,6165.61,6427.3,8550.17,9693.62,9955.31,11314.81,12957.84,6788.84,8637.19,7602.19,7933.1,9248.15,9891.56,11638.96,6645.87,4012.9,2064.9,3973.16,5696.16,4435.16,6081.72,5109.72,7057.13,8905.47,7235.47,4548.47,6396.82,4775.82,6624.17,8270.73,7242.73,8990.13,6923.13,8670.53,7740.53,9588.88,9442.88,9442.88,11728.03,11958.79,11958.79,9211.31,12050.46,17412.63,18606.98,20571.94,21160.37,22524.71,24272.11,21202.11,24188.31,24419.07,26166.47,26930.38,25119.77,26147.77,28674.81,28674.81,30672.76,31235.8,33444.9,32415.59,34197.91,38268.73,38953.42,40965.87,41794.83,37245.1,36120.11,36884.02,38732.36,31053.36,32659.2,34050.45,32767.95,34721.95,34795.65,32759.29,34339.31,35081.25,37212.23,39412.05,35757.72,36019.41,32788.41,34474.13,36322.47,37423.88,35020.88,36869.22,33350.22,35198.57,36841.6,37605.51,39106.96,38594.96,32722.96,33651.3,34657.37,35421.28,34719.68,36366.24,38214.59,39043.54,40891.89,42639.29,44386.69,46235.03,48083.38,49830.78,49417.78,46499.78,48348.12,41877.47,39380.47,39030.47,38170.47,37614.87,39463.22,34664.78,36612.19,33610.1,32748.5,35259.81,39510.01,40994.76,37698.76,40210.07,42058.42,43279.82,42039.82,43888.16,41773.16,41890.51,41161.51,44858.2,34695.2,35544.76,28113.76,29962.11,30518.8,32367.15,27234.15,25178.49,22920.49,23787.88,26272.62,28020.02,29521.47,28669.47,34012.72,34116.72,28131.72,27499.48,29246.88,31095.22,32943.57,23517.6,25265,22955,24702.4,24653.75,26401.15,23354.15,23785.89,8755.89,10604.24,8341.24,7711.24,10430.24,9460.24,13156.93,15005.27,16752.67,18601.02,16401.02,14064.37,8238.37,8238.37,10086.71,11935.06,13581.62,13973.97,17569.71,19216.28,15325.62,9476.62,11119.66,7085.66,5589.66,7537.06,7103.41,8746.44,8514.01,10157.04,10070.39,7459.12,9307.47,9327.23,7557.23,6707.23,7427.57,6334.57,8182.92,9829.48,7770.83,9413.87,14351.56,16199.9,17947.3,20949.84,20071.84,19762.84,16762.84,18409.4,15829.4,17807.83,19656.18,20420.09,20260.09,21903.12,24625.17,20465.17,22212.57,22023.57,23823,21488,23336.35,23051.75,24536.5,26762.34,30333.63,31292.67,31848.07,32074.82,32838.73,34185.42,36394.52,37305.95,37373.66,37747.78,37442.03,40877.62,44631.2,40783.2,39733.11,35251.11,36709.18,38854.17,41519.74,40316.14,39586.16,35849.5,32469.04,26605.04,24099.77,27035.37,28852.41,23500.44,20952.44,19899.2,22058.2,21475.9,26097.61,27192.96,24356.37,25999.4,27862.65,29810.05,31673.3,31529.87,33547.56,31370.66,32152.06,34663.37,34304.37,36152.72,38001.06,40750.78,46887.89,45572.89,38619.24,36544.27,31201,32560.5,31551.53,30462.44,28394.44,27458.44,27594.8,29382.79,30442.5,32189.9,29355.9,31281.92,29265.83,28130.83,28894.74,27780.3,30250.15,28770.15,26810.55,24149.55,25257.24,20096.24,23501.87,25350.21,17145.19,5232.19,7080.53,6252.95,6318,5633,8910.44,9804.43,11652.78,9965.78,13356.21,11815.61,10769.01,12516.41,13345.36,14873.18,12935.18,6090.14,5910.14,7758.48,7680.52,6127.52,7770.55,7770.55,4666.55,2374.55,3138.46,2665.46,-1459.54,2136.21,3883.61,365.61,1725.11,3368.14,5315.55,3471.46,2197.86,1787.89,-2993.11,-1236.7,-2460.01,-3130.01,-3255.01,-1406.66,236.37,1518.97,-3176.03,-5323.03,-3474.69,-2537.86,-4024.86,-518.58,-671.58,1075.82,-2888.18,808.51,-4388.49,-2525.24,-4097.24,-4272.24,-6514.66,-4871.62,-3023.28,-3291.28,-1428.03,-2472.99,704.91,-924.09,823.31,-5191.69,-3343.35,-1595.95,-9731.95,-7984.55,-6136.2,-4388.8,-2641.4,-3594.4,-3594.4,-1746.05,-3378.05,-6851.05,-9920.71,-8072.36,-9548.36,-5851.67,-7468.11,-11369.11,-10458.76,-6747.17,-8519.17,-7607.65,-2509.64,-2502.6,-654.25,1034.55,-1599.45,715.11,-1008.89,-2644.61,-781.36,-5095.36,-6941.36,-3345.62,-1699.05,48.35,-5246.65,-4222.57,-3458.66,-5499.66,-4155.66,-6642.66,-4084.58,-4019.53,-8896.53,-11026.19,-11865.84,-10443.5,-14807.5,-15740.5,-16325.5,-15233.15,-13889.15,-16054.15,-11996.83,-11765.04,-11182.23,-10508.3,-8263.47,-6865.53,-6146.37,-2074.03,-868.55,-285.75,-1322.98,-1783.98,1554.66,2302,-1100.19,-4237.19,-5614.15,-4926.49,-5535.42,-3892.39,-397.59,-4734.99,-2987.59,-4290.38,-2442.03,-2350.9,-2115.73,-2275.73,-528.33,-3575.33,-1726.99,-472.14,291.77,-2798.89,-9426.89,-8725.54,-5028.85,-9992.85,-8346.29,-6497.94,-6793.94,-4808.56,-10247.16,-10354.6,-8607.2,-10384.85,-8536.51,-9653.51,-6911.76,-4486.31,-5148.91,-4078.11,-8178.11,-18389.11,-19113.36,-21379.36,-19531.02,-19658.02,-21124.02,-20597.45,-18950.88,-23477.88,-22543.24,-21626.71,-28262.71,-28410.97,-26663.57,-26850.57,-27235.57,-25387.22,-25875.22,-32323.22,-35978.22,-40778.22,-41548.22,-42025.22,-40176.88,-38328.53,-40148.53,-43223.53,-43223.53,-46937.53,-44152.36,-41399.62,-44496.62,-42648.27,-44858.92,-44294.58,-46610.58,-45334.55,-39400.99,-35358.67,-33846.66,-28289.41,-25734.07,-25130.66,-23383.26,-23352.11,-20841.23,-18939.55,-21368.15,-25356.14,-23659.19,-20052.83,-19881.95,-24043.3,-21963.03,-21723.96,-19875.61,-19869.92,-18415.22,-20493.22,-24509.11,-23694.82,-22487.58,-20094.73,-19341.39,-28674.99,-28499.34,-26751.94,-26895.69,-25148.29,-24517.24,-27037.62,-26538.11,-21678.98,-19873.9,-27585.23,-28958.93,-27793.51,-24846.72,-23895.54,-22744,-22038.91,-23262.88,-28579.51,-28486.04,-28480.35,-27272.38,-34006.32,-32281.23,-30889.01],
options: {
marginTop: 60,
colors: ['#0c0'],
title: 'Gravity Status',
hmargin: 15,
marginLeft: 60,
marginRight: 35,
marginBottom: 50,
yaxisUnitsPre: '$',
linewidth: 3,
backgroundGridVlinesCount: 7,
backgroundGridHlinesCount: 10,
filled: true,
filledColors: [fills[0]],
yaxisMin: 'mirror',
xaxisTickmarks: false,
backgroundGridBorder: false,
backgroundGridVlines: false,
yaxis: false
}
}).draw();


line2 = new RGraph.SVG.Line({
id: 'cc2',
data: Edata,
options: {
marginTop: 60,
title: 'Entitled & Written Premium',
hmargin: 15,
marginLeft: 60,
marginRight: 35,
marginBottom: 50,
yaxisMin: 'mirror',
yaxisUnitsPre: '$',
linewidth: 3,
backgroundGridVlinesCount: 7,
backgroundGridHlinesCount: 10,
yaxis: false,
filled: true,
filledColors: [fills[1]],
backgroundGridBorder: false,
backgroundGridVlines: false
}
}).draw();


// Create the clipPath element that sits inside the <def> tag
clip = RGraph.SVG.create({
svg: line.svg,
type: 'clipPath', // This is case sensitive!
parent: line.svg.defs,
attr: {
id: 'myClip'
}
});

// Create the shape element for the clip area
RGraph.SVG.create({
svg: line.svg,
parent: clip,
type: 'rect',
attr: {
// These coordinates create a rect that is the same size as the top half of the SVG tag
x: 0,
y: 0,
width: 900,
height: 306
}
});

// Now set the clip-path attribute on the first Line charts all-elements group
line.svg.all.setAttribute(
'clip-path',
'url(#myClip)'
);



// Create the clipPath element that sits inside the <def> tag *** for the bottom half of the chart ***
clip2 = RGraph.SVG.create({
svg: line2.svg,
type: 'clipPath', // This is case sensitive!
parent: line2.svg.defs,
attr: {
id: 'myClip2'
}
});

// Create the shape element for the clip area
RGraph.SVG.create({
svg: line2.svg,
parent: clip2,
type: 'rect',
attr: {
// These coordinates create a rect that is the same size as the bottom half of the SVG tag
x: 0,
y: 305,
width: 900,
height: 300
}
});

// Now set the clip-path attribute on the second Line charts all-elements group
line2.svg.all.setAttribute(
'clip-path',
'url(#myClip2)'
);

Posted by Richard at 20:45 on Friday 18th March 2022 [link]
Can you give me some idea of what the chart s supposed to look like?

Posted by Todd Shafer at 20:53 on Friday 18th March 2022 [link]
Here a picture - https://milehighinsurancebrokers.com/agent_portal/images/gravitychart.JPG

Posted by Richard at 21:44 on Friday 18th March 2022 [link]
Try this:

https://codepen.io/rgraph/pen/dyJMNzj

Posted by Todd Shafer at 22:12 on Friday 18th March 2022 [link]
You're the man!

[Replies are closed]