var renderer;
var context;
var xScale;
var yScale;
// set these values for your data
var sections = 12; // 12 month
var Val_max = 130;
var Val_min = -40;
var stepSize = 10;
var columnSize = 50;
var rowSize = 50;
var margin = 15;
var xAxisData = [" ", "Jan", "Feb", "Mar", "Apr",
"May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
// Values for the Data Plot, they can also be obtained from a external file
var Nokia = [20, -10, -20, -25, -40, 5, 10, 28, 30, 43, 65, 80];
var axisFont = {fontFamily: "Arial", fontSize: 14, fill: "black"};
function init() {
createRenderer();
//Create a container object called the `stage`
context = new PIXI.Container();
definedScale();
// print Parameters on X axis, and grid lines on the graph
drawXAxis();
// print row header and draw horizontal grid lines
drawYAxis();
// plot data series
plotData(Nokia, 0x9933FF); // purple
//Tell the `renderer` to `render` the `stage`
renderer.render(context);
}
function createRenderer() {
//Create the renderer
renderer = PIXI.autoDetectRenderer(window.innerWidth, window.innerHeight,
{antialias: true, transparent: false, resolution: 1});
renderer.view.style.position = "absolute";
renderer.view.style.display = "block";
renderer.autoResize = true;
renderer.backgroundColor = 0xEFF5FF;
//Add the canvas to the HTML document
document.body.appendChild(renderer.view);
window.addEventListener("resize", function (event) {
scaleToWindow(renderer.view);
});
}
function definedScale() {
yScale = (renderer.view.height - (margin + rowSize)) / (Val_max - Val_min); // yScale means how many pixel should be need to show 1 point
xScale = (renderer.view.width - (columnSize + margin)) / sections; //...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.