Home Forums Chart Support Data Store

Data Store

Viewing 5 posts - 1 through 5 (of 5 total)
  • #11482

    I am fairly new to Javascript and Graphs. I have the following HTML code which works fine:

    <!DOCTYPE HTML>
    <html>
    <head>
    <script src="https://cdn.canvasjs.com/canvasjs.min.js"></script>
    <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.js"></script>
    <script type="text/javascript">
    
    
    window.onload = function () {
    	var chart = new CanvasJS.Chart("chartContainer", {
    		width:1300,
    		zoomEnabled: true,
    		animationEnabled: true,
    		exportEnabled: true,
    		axisX:{
    			title: "Job Manager",
    			labelAngle:-30,
    			labelFontSize:16,
    			interval:1
    			},
    		axisY:{
    			title: "Error Count"
    			},
    		title:{
    			text: "Epoch User Errors"              
    		},
    		data: [              
    		{
    			type: "column",
    			dataPoints: [
    {label: "Robert Allen", y: 20},
    {label: "Jade Parry", y: 12},
    {label: "Stephen Press", y: 12},
    {label: "Andrea Hilton", y: 11},
    {label: "Victor Field", y: 10},
    {label: "Samantha Simpson", y: 9},
    {label: "Amanda Calvert", y: 7},
    {label: "Chris Sykes", y: 6},
    {label: "Debbie Lynch", y: 6},
    {label: "Carol Nunley", y: 6},
    {label: "Alexander Mcdonald", y: 5},
    {label: "Dani Leman", y: 5},
    {label: "Debbie Cloke", y: 4},
    {label: "John Hanson", y: 4},
    {label: "Rita Upton", y: 4},
    {label: "Toby Graveling", y: 4},
    {label: "Samantha James", y: 3},
    {label: "Spencer Holloway", y: 3},
    {label: "Nicky Byrne", y: 3},
    {label: "Derek Eaton", y: 2},
    {label: "Matthew Beale", y: 2},
    {label: "Sonia Downes", y: 2},
    {label: "Daniel King", y: 1},
    {label: "Elaine George", y: 1},
    {label: "Julie Brooks", y: 1},
    {label: "Tina Morley", y: 1}
    ]
    		}
    		]
    	});
    
    	chart.render();
    }
    </script>
    </head>
    <body>
    <div id="chartContainer" style="height: 550px; width: 100%;"></div>
    </body>
    </html>

    but I want to store the data in a csv file, so I can update it on a regular basis. In the following format

    Robert Allen,20
    Jade Parry,12
    etc

    How can I go about doing this. Any help will be appreciated.

    Thanks

    Simon

    #11484

    Simon,

    You can use use jQuery.ajax() to get data from external csv file and pass it to chart. Check this jsfiddle.

    #11485

    Thank you. Sorry but would you know how I can put this into my code. I have been trying with no success.

    As I say I am fairly new to this.

    #11487

    Simon,
    Check these links for your working code. Data from external CSV, Data saved as String.

    #11488

    Thanks for that.
    My csv file is in a drive on my companies network, in the same folder as my HTML coding. when I change the URL to the drive, it doesn’t work?

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.