Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

408
Views
GraphObject.make requiere una función de clase o un nombre de clase de GoJS o el nombre de un generador de objetos, no: indefinido

Estoy siguiendo el tutorial de la biblioteca go.js: https://www.youtube.com/watch?v=EyseUD_i6Dw&list=PLOiCuGu6tcUSvKsqFnemvGTfdT97wVLsX&index=3 .

Llegué a este punto sin problemas, pero en este punto me sale este error:

 GraphObject.make requires a class function or GoJS class name or name of an object builder, not: undefined

Este es mi código:

 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Test</title> <script src="https://unpkg.com/gojs@2.2.5/release/go.js"></script> <script> function init() { var $ = go.GraphObject.make; myDiagram = $(go.Diagram, "myDiagramDiv"); myDiagram.add( $(go.Part, "Position", $(go.Shape, "RoundedRectangle", {fill: "white"}), $(go.textBlock, "some text") ) ); } </script> </head> <body onload="init()"> <div id="myDiagramDiv" style="height: 400px; width: 400px; border: 1px solid black;"></div> </body> </html>

¿Alguien sabe dónde está el problema? ¿Algún problema de versión quizás? He probado con diferentes versiones de go.js, pero siempre tengo el mismo problema.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Has escrito mal go.TextBlock (escribiste go.textBlock )

Por cierto, en 2.2 (que se lanzó después de que se hicieran esos videos), GoJS tiene una nueva forma de construir objetos que se ve así:

 function init() { myDiagram = new go.Diagram("myDiagramDiv"); myDiagram.add( new go.Part("Position") .add(new go.Shape("RoundedRectangle", {fill: "white"})) .add(new go.TextBlock("some text")) ); }

Este método de encadenamiento como new go.Part().add(someObject).add(anotherObject) le permite escribir código que es conciso como GraphObject.make , pero los errores son más claros. En el caso de su error tipográfico, en su lugar vería:

Uncaught TypeError: go.textBlock is not a constructor

Y señalaría la línea específica: ingrese la descripción de la imagen aquí

Lea más sobre el encadenamiento de métodos en lugar de usar GraphObject.make , consulte: https://gojs.net/latest/changelog.html

https://gojs.net/latest/intro/buildingObjects.html

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!