asp.net mvc 5 - FusionCharts - Adding images to a scatter chart(XML,C# MVC) -
i new fusioncharts , struggling able add images fusionchart. please forgive me, dont know how supposed ask question, if there data want me add help, please let me know.
i have working plotting x , y points , setting anchorsides , anchorradius, want replace these image , have no idea how to.
here portion using foreach populate x , y axis :
strxml += "<dataset drawline= '0' seriesname= 'peak' color= '#ff0000' anchorsides= '3' anchorradius= '5' anchorbgcolor= '#ff0000' anchorbordercolor= '#ff0000'>"; foreach (var cat in calclist) { if (cat.ispeak) { strxml += "<set y='" + cat.elevation + "' x='" + cat.accumulated_length + "'/>"; } } strxml += "</dataset>";
ive gone onto fusionchart site , see :
<annotations width="500" height="300" autoscale="1"> <annotationgroup id="user-images" xscale_="20" yscale_="20"> <annotation id="butterfinger-icon" type="image" url="http://static.fusioncharts.com/sampledata/images/butterfinger.png" x="$xaxis.label.0.x - 30" y="$canvasendy - 150" xscale="50" yscale="40" /> <annotation id="tom-user-icon" type="image" url="http://static.fusioncharts.com/sampledata/images/snickrs.png" x="$xaxis.label.1.x - 26" y="$canvasendy - 141" xscale="48" yscale="38" /> <annotation id="milton-user-icon" type="image" url="http://static.fusioncharts.com/sampledata/images/coffee_crisp.png" x="$xaxis.label.2.x - 22" y="$canvasendy - 134" xscale="43" yscale="36" /> <annotation id="brian-user-icon" type="image" url="http://static.fusioncharts.com/sampledata/images/100grand.png" x="$xaxis.label.3.x - 22" y="$canvasendy - 131" xscale="43" yscale="35" /> </annotationgroup> </annotations>
so have tried myself, giving me error :
//peak images strxml += "<annotations>"; strxml += "<annotationgroup>"; foreach (var cat in calclist) { if (cat.ispeak) { strxml += "<annotation id='test' type='image' url='http://static.fusioncharts.com/sampledata/userimages/1.png' x='$dataset.0.set." + ipeakcount +".x-" + cat.elevation + "' y='$dataset.0.set." + ipeakcount + ".y-" + cat.accumulated_length + "'/> "; ipeakcount++; } } strxml += "<annotationgroup>"; strxml += "<annotations>";
but getting "invalid data" fusionchart.
we have done similar using json
test previously, know possible - except want using xml(which have done), have no idea how :( - below snippet of code :
"annotations": { "groups": [ { "id": "anchor-highlight", "items": [ { "id": "high-star", "type": "image", "url": "http://static.fusioncharts.com/sampledata/userimages/1.png", "x": "$dataset.0.set.11.x-25", "y": "$dataset.0.set.11.y-25" }, { "id": "high-star", "type": "image", "url": "http://static.fusioncharts.com/sampledata/userimages/1.png", "x": "$dataset.0.set.6.x-25", "y": "$dataset.0.set.6.y-25" } ] } ] },
am missing plot or missing ?
please go gentle on me, new me , struggling quite bit.
thanking in advance.
found answer myself again...
below code :
strxml += "<annotations>"; strxml += "<annotationgroup>"; foreach (var cat in calclist) { if (cat.ispeak) { strxml += "<annotation id='peak" + ipeakcount + "' type='image' url='/images/peak.png' x='$dataset.2.set." + ipeakcount + ".x-12' y='$dataset.2.set." + ipeakcount + ".y-12' xscale='6' yscale='6' />"; ipeakcount++; } } strxml += "</annotationgroup>"; strxml += "</annotations>";
you notice following :
x='$dataset.2.set." + ipeakcount + ".x-12' y='$dataset.2.set." + ipeakcount + ".y-12'
the number 2 means must display on 3rd dataset(datasets start @ 0). below 1 of datasets :
strxml += "<dataset drawline= '1' seriesname= 'elevation' color= '#0045ff' anchorsides= '0' anchorradius= '0' anchorbgcolor= '#0045ff' anchorbordercolor= '#0045ff'>"; foreach (var cat in calclist) { if (cat.elevation >= 0) { strxml += "<set y='" + cat.elevation + "' x='" + cat.accumulated_length + "'/>"; } } strxml += "</dataset>";
hope helps else...
Comments
Post a Comment