dataSeries.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import { Color3 } from "babylonjs";
  2. /** Class used to store data to display */
  3. export class DataSeries {
  4. /** Gets or sets the label of the series */
  5. public label: string;
  6. /** Gets or sets the color associated with the series */
  7. public color: Color3;
  8. /** Gets or sets the list of dimensions (used to filter data) */
  9. public dimensions: Array<string>;
  10. /** Gets or sets the list of values (data to display) */
  11. public data: Array<any>;
  12. public static CreateFakeData(): DataSeries {
  13. var series = new DataSeries();
  14. series.label = "Product #1";
  15. series.color = Color3.Red();
  16. series.dimensions = ["Year", "Country"];
  17. series.data = [
  18. {
  19. "Year": 2014,
  20. "Country": "France",
  21. "value": 10
  22. },
  23. {
  24. "Year": 2014,
  25. "Country": "USA",
  26. "value": 200
  27. },
  28. {
  29. "Year": 2014,
  30. "Country": "India",
  31. "value": 400
  32. },
  33. {
  34. "Year": 2014,
  35. "Country": "UK",
  36. "value": 180
  37. },
  38. {
  39. "Year": 2015,
  40. "Country": "France",
  41. "value": 12
  42. },
  43. {
  44. "Year": 2015,
  45. "Country": "USA",
  46. "value": 120
  47. },
  48. {
  49. "Year": 2015,
  50. "Country": "India",
  51. "value": 480
  52. },
  53. {
  54. "Year": 2015,
  55. "Country": "UK",
  56. "value": 10
  57. }
  58. ];
  59. return series;
  60. }
  61. }