cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <html>

<head>
	<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
	<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.js"></script>
	<script type="text/javascript">
		window.onload = function () {
			
 // note : just for demo data is passed directly and not via ajax
var dataCsv;
/*$.ajax({
        type: "GET",
        url: "https://codepen.io/vishwas/pen/PzmZja.js",
        dataType: "text",
        success: function (dataCsv) { processData(dataCsv); }
    });
*/

var data = [];
var dataCsv =  'Robert Allen,20\nJade Parry,12\nStephen Press,12\nAndrea Hilton,11\nVictor Field,10\nSamantha Simpson,9\nAmanda Calvert,7\nChris Sykes,6\nDebbie Lynch,6\nCarol Nunley,6\nAlexander Mcdonald,5\nDani Leman,5\nDebbie Cloke,4\nJohn Hanson,4\nRita Upton,4\nToby Graveling,4\nSamantha James,3\nSpencer Holloway,3\nNicky Byrne,3\nDerek Eaton,2\nMatthew Beale,2\nSonia Downes,2\nDaniel King,1\nElaine George,1\nJulie Brooks,1\nTina Morley,1';


function addDataPoint(label,yValue){
    var yData = parseInt(yValue);
		var labelData = label;
    var dataFlag = false;
    for(var i=0;i<data.length;i++){       
            data[i].dataPoints.push({label:labelData, y:yData});
            dataFlag = true;
    }
    if(!dataFlag){
        data.push({
            type : "column",
            dataPoints : [
                {label: labelData, y:yData}
            ]
        });
    }
}

function processData(allText) {
    var allLinesArray = allText.split('\n');
    if (allLinesArray.length > 0) {
        for (var i = 0; i <= allLinesArray.length - 1; i++) {
            var rowData = allLinesArray[i].split(',');
            addDataPoint(rowData[0],rowData[1]);
        }
        chart.render();
    }
}


var chart = new CanvasJS.Chart("chartContainer", {			
    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: data
  });

processData(dataCsv);
		}
	</script>
</head>

<body>
	<div id="chartContainer" style="height: 550px; width:100%"></div>
</body>

</html>
            
          
!
999px
Loading ..................

Console