lineGradient2.vue 994 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <template>
  2. <div>
  3. <canvas id="lineGradient2" width="740" height="400" tabindex="0"/>
  4. </div>
  5. </template>
  6. <script>
  7. import { SGraphScene, SGraphView } from "@persagy-web/graph/lib";
  8. import { SLinearGradient } from "@persagy-web/draw/lib";
  9. import {GradRect} from "./GradRect";
  10. export default {
  11. name: "lineGradient1",
  12. data(){
  13. return {
  14. view: ''
  15. }
  16. },
  17. mounted() {
  18. this.init();
  19. },
  20. methods:{
  21. init(){
  22. this.view = new SGraphView('lineGradient2');
  23. const scene = new SGraphScene();
  24. const grad = new SLinearGradient(0,0,1000,0);
  25. const item = new GradRect(null, grad);
  26. scene.addItem(item);
  27. this.view.scene = scene;
  28. this.view.fitSceneToView();
  29. this.view.scalable = false;
  30. }
  31. }
  32. }
  33. </script>
  34. <style scoped>
  35. </style>