Line Chart - Demo

A very static LineChart.



Source code

All code for the LineChart is written in Jscript, and it relies on four include files. These are included in the package, and you are free to modify them for personal use.

  1. <%@LANGUAGE="JScript">
  2. // Include the LineDiagram script library.
  3. <!--#include file="LineDiagram.asp"-->
  4. <%
  5. // Create a new LineDiagram
  6. var diagramObj = new LineDiagram();
  7. diagramObj.CreateBackground(500, 300, 0xC9F0FF)
  8. // Settings for the x-scale
  9. diagramObj.xScale.label = "Month";
  10. diagramObj.xScale.SetPosition(100, 180, 260);
  11. diagramObj.xScale.SetLabelFont("Arial", 12, "normal", 0x000000, true, false, 0);
  12. diagramObj.xScale.SetValueFont("Arial", 12, "normal", 0x000000, true, false, 0);
  13. diagramObj.xScale.minValue = 0;
  14. diagramObj.xScale.maxValue = 12;
  15. diagramObj.xScale.stepSize = 1;
  16. diagramObj.xScale.lineColor = 0x000000;
  17. diagramObj.xScale.lineSize = 1;
  18. diagramObj.xScale.showGrid = true;
  19. // Settings for the y-scale
  20. diagramObj.yScale.label = "Sales (million units)";
  21. diagramObj.yScale.SetPosition(100, 180, 150);
  22. diagramObj.yScale.SetLabelFont("Arial", 13, "bold", 0x000000, true, false, 0);
  23. diagramObj.yScale.SetValueFont("Arial", 12, "normal", 0x000000, true, false, 0);
  24. diagramObj.yScale.minValue = 0;
  25. diagramObj.yScale.maxValue = 10;
  26. diagramObj.yScale.stepSize = 2;
  27. diagramObj.yScale.lineColor = 0x000000;
  28. diagramObj.yScale.lineSize = 1;
  29. diagramObj.yScale.showGrid = true;
  30. var graph1 = new LDGraph();
  31. graph1.label = "Bad Trend";
  32. graph1.lineColor = 0xff0000;
  33. graph1.lineSize = 1;
  34. graph1.showLabel = true;
  35. var graph2 = new LDGraph();
  36. graph2.label = "Positive Trend";
  37. graph2.lineColor = 0x0000FF;
  38. graph2.lineSize = 1;
  39. graph2.showLabel = true;
  40. graph1.AddPoint(1,8);
  41. graph1.AddPoint(2,5);
  42. graph1.AddPoint(6,7);
  43. graph1.AddPoint(10,6);
  44. graph1.AddPoint(11,5);
  45. graph1.AddPoint(12,0);
  46. graph2.AddPoint(1,2);
  47. graph2.AddPoint(2,6);
  48. graph2.AddPoint(3,6);
  49. graph2.AddPoint(5,6);
  50. graph2.AddPoint(6,7);
  51. graph2.AddPoint(8,8);
  52. graph2.AddPoint(10,8);
  53. graph2.AddPoint(11,7);
  54. graph2.AddPoint(12,8);
  55. // Add the graphs
  56. diagramObj.graphs.push(graph1);
  57. diagramObj.graphs.push(graph2);
  58. // Set the value
  59. diagramObj.graphInfo.startXPos = 370;
  60. diagramObj.graphInfo.startYPos = 20;
  61. diagramObj.graphInfo.boxWidth = 15;
  62. diagramObj.graphInfo.boxHeight = 10;
  63. diagramObj.graphInfo.boxSpacing = 5;
  64. diagramObj.graphInfo.lineColor = 0x000000;
  65. diagramObj.graphInfo.SetLabelFont("Tahoma", 12, "normal", 0x000000, true, false);
  66. // Draw the diagram
  67. diagramObj.DrawDiagram();
  68. %>