How to create a chart with Chart WebPart from comma separated values in one list column
-
10-12-2019 - |
Question
I want to create a chart with the built in Chart WebPart in SP 2010 from a comma separated values string in one column of a forms library.
It is a form library with promoted fields of an InfoPath form. There is a rule that gathers values from a repeated section and writes it to another field, seperated by comma. That field is promoted to a FormsLibrary column.
There should be one chart beneath the XsltListViewWebPart of the Forms library. The chart should update just when the user clicks on one of the Form items.
I managed to add a Chart Webpart to the page and connect it to the forms lib, but it wants to get its data from several list items, not just only from the current one.
Is it possible without programming to tell the Chart WebPart to split a comma seperated string from one list item field? Maybe I need to add a hidden webpart which splits the comma seperated string into values?
The Chart should look like this (or similar)
The field content looks like this: "1,6,8,3,4,9,2,4,1,2,5,8,7,9,2,4,8"
Solution
What about using Excel REST? You can create the chart you want to see in Excel then call it using REST passing through the values as parameters. Make sure you name the chart in Excel and I would also recommend you name the cells for the values using short names.
Getting an image on the page using a REST call will be something like:
<img src="http//ServerName/_vti_bin/ExcelRest.aspx/LibraryName/WorkbookName.xlsx/model/Charts('ChartName')?Ranges('V1')=1&Ranges('V2')=6&Ranges('V3')=8& . . . etc" />
OTHER TIPS
If your talking about a .csv file than it is possible as its a common format that is used in excel.
For those who dont know what csv is, its just a simple method of storing values seperated by a comma. Its readable by excel and is put into respective cells. CSV is also a good method for charting.
First step is to get the values into a .csv file. Save that file to a document library. goto the document library and right click the file and copy its url location (copy shortcut).
you can try this:
As you noted that you would need to connect either by webpart that sends the data or you can try csv file that is stored in a document library (i dont know if it will like scv but it does work for xcsl format)
Connect to another Web Part
Use this option to connect the Chart Web Part to another Web Part that is capable of sending data. Examples of such Web Parts include a Document Library or a Contacts list.
Note Make sure that the Web Part that you want to use is already on the same page as the Chart Web Part
or
Goto the page where you want to show the chart. Add Collabion Charts for SharePoint:
Collabion Charts for SharePoint lets you create charts from data stored in SharePoint® Lists, Views, CSV string or files, MS SQL, Oracle, Excel and BDC
http://www.fusioncharts.com/products/ccsp/
Click on the wizard, follow the wizard. Format (data provider) needs to be csv, check from web just below. Past in the url. Hit connect. Select what feilds you need and click apply and then on the right click chart type to select your chart and follow the wizard from there :)
vid tutorial here:
http://www.youtube.com/watch?v=d34saR_Gsk8
documentation:
http://docs.collabion.com/charts/1.1/
for excel way
http://www.codeproject.com/Articles/22239/Displaying-Charts-in-SharePoint-using-Excel-Servic