loader_trace.html 951 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title></title>
  5. </head>
  6. <body>
  7. <div id="mountNode"></div>
  8. <script src="https://gw.alipayobjects.com/os/antv/assets/g2/3.0.9/g2.min.js"></script>
  9. <script>
  10. var data = {{placeholder}};
  11. const chart = new G2.Chart({
  12. container: 'mountNode', // 指定图表容器 ID
  13. height: data.length * 22, // 指定图表高度
  14. forceFit: true,
  15. padding: 'auto',
  16. });
  17. // Step 2: 载入数据源
  18. chart.source(data, {
  19. range: {
  20. type: 'time',
  21. mask: 'HH:mm:ss',
  22. nice: true,
  23. },
  24. });
  25. chart
  26. .coord()
  27. .transpose()
  28. .scale(1, -1);
  29. chart.legend({ position: 'top' });
  30. chart.tooltip({
  31. showTitle: false,
  32. itemTpl: '<li>{duration}ms: {name} </li>'
  33. });
  34. chart
  35. .interval()
  36. .position('title*range')
  37. .color('type')
  38. .tooltip('name*duration', (name, duration) => ({ name, duration }))
  39. .size(5);
  40. chart.render();
  41. </script>
  42. </body>
  43. </html>