Adjusting the text size within the graphdracula library

I recently implemented a cool feature in my asp.net mvc4 application by adding a treeview using the graphdracula jQuery library. Here is a snippet of the code I used:

<html>
  <head>
    <script type="text/javascript" src="~/Content/Scripts/raphael-min.js"></script>
    <script type="text/javascript" src="~/Content/Scripts/dracula_graffle.js"></script>
    <script type="text/javascript" src="~/Content/Scripts/dracula_graph.js"></script>
    <script type="text/javascript" src="~/Content/Scripts/dracula_algorithms.js"></script>
      <script type="text/javascript">
         $(document).ready(function () {
            var width = $(document).width() -500;
            var height = $(document).height();
            var g = new Graph();
            g.edgeFactory.template.style.directed = true;

           @for(int i =0;i < @Model[1].Count; i+=2){
              @: g.addEdge("@Html.Raw(@Model[1][i])","@Html.Raw(@Model[1][i+1])");

           }
            var layouter = new Graph.Layout.Ordered(g, topological_sort(g));
            var renderer = new Graph.Renderer.Raphael('canvas', g, width, height);

            });
       </script>
  </head>
  <body>

    <div id="canvas"></div>
     </body>
</html>

After running the code, I realized that I needed to change the font-size of the edge titles to 18px, but I couldn't locate the specific part of the code where this modification could be made.

Can anyone guide me on how to locate and modify the target code for adjusting the font size?

Answer №1

To implement custom node rendering, you should refer to the instructions provided in the official documentation.

Below is a snippet of code that showcases the key components used in my own local testing:

var g = new Graph();

var render = function(renderer, node) {
    var color = Raphael.getColor();
    var set = renderer.set().
        push(renderer.ellipse(node.point[0], node.point[1], 30, 20).attr({fill: color, stroke: color, "stroke-width": 2})).
        push(renderer.text(node.point[0], node.point[1] + 30, node.label || node.id).attr({"font-size": "18px"}));
    return set;
};

/* Add nodes with custom rendering */
g.addNode("strawberry", { render : render });
g.addNode("cherry", { render : render });

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is it possible to incorporate a next.js image onto the background design?

I've encountered an issue while attempting to create a fixed background image with a parallax effect using Tailwind CSS and Next.js Image. If you need to see an example of this in action, check out this Template Monster theme. Here's the code s ...

Configuring Angular with Selenium to utilize model-driven values

Within the DOM, there is an input element linked to ng-model='obj.values.x.value' obj.values.x.value currently holds the value "foo". When using Selenium to run the code, the field displays "foo". However, after attempting to clear the field usi ...

The transition effect for the box shadow is being altered to modify the dimensions

--- UPDATE 2 ---- Here is a different example video showcasing the bizarre behavior of my react application. I am struggling to identify the root cause of this issue. See the issue in action I have a div with the class name side-btn It contains an anim ...

Inline CSS for altering the appearance of text within a DIV container

Within the confines of this DIV element... <div name="layer1" style="background-color:lightblue;"> <hr>Site:Downtown DataCenter Device: 2KBS</hr> </div> Hello there, I am utilizing Inline CSS Styling. Is it possible to make the t ...

When an exception is thrown, the custom error page fails to display

I've implemented a custom error handler to display diagnostic information to users in case of a crash. However, the custom error page is not showing up and instead, I'm encountering an exception while attempting to display the error page. I' ...

Challenges encountered while using JQuery Validation for a form submission for the second time (JQuery Steps)

Currently, I am implementing JQuery Steps for the registration form on my website. The registration process involves three steps: Personal > Company > Confirm. I have configured the form to display error messages in the "placeholder" if a textbox is ...

Can you explain the distinction between "<% %>" and "<%=%>" tags in programming?

Can you explain the distinction between <% %> and <%= %> within the context of ASP.NET MVC? Furthermore, in what situations should each be used? ...

A webpage designed specifically for handling ajax requests and providing information on how to properly set the content type

Currently in the process of creating a .aspx page to handle ajax requests. How should I go about setting the content type in order for the JSON response to be received correctly by the calling page? Just FYI, I am utilizing jquery for this task. ...

Styling a layout with two columns, centered with an offset

I have created a layout with two columns - one on the left and one on the right, with the left column containing two rows. However, I am looking to offset the center point of the column to the right so that the left column occupies about 60% of the space ...

Using JQuery AJAX to pass CSRF in a Symfony2 form

I have been working on a comments box that utilizes JQuery AJAX call to save the comment. JQuery Implementation Below is the code snippet for using JQuery (which works flawlessly): $(".post-comment").click(function() { var $form = $(this).closest("f ...

"Place the content at the center of the row using display block in Bootstrap version

Having modified the bootstrap.min.css file in my Bootstrap v4.3.1, I replaced all instances of display:flex; with display:block;. However, after making this change, I noticed that the rows were no longer centered, even when using justify-content-center. T ...

Utilizing JQuery to make Google listings easily findable

Implementing Google Places for a location text box has been successful. However, I am now looking to create a class-based implementation so that I can use it with multiple places effortlessly. Is it possible to achieve this using JQuery? <script type ...

How to keep an image anchored at the bottom of the page without overlapping other content

I'm trying to have a logo image stay fixed at the bottom of a navigation drawer, but when I use absolute positioning and set it to the bottom, it overlaps with the list items on shorter devices. When the scroll bar appears due to shrinking the browser ...

How can I implement JQuery colorbox in a JSP file without creating a new file for content within a specific div?

Currently, I am utilizing JQuery colorbox in the following way: A link (represented as a button) with the class cboxElement displays the html content of colorbox from another JSP file when clicked. Everything works smoothly up to this point. However, I am ...

ASP.NET Development: Understanding Architectural Design and Class Diagrams

Looking to dive into ASP.NET Development. Does anyone have any recommendations for a resource that provides sample code, architecture, class and sequence diagrams for a simple ASP.NET application with 3 / 4 / n-tier structure? Any help would be greatly a ...

Leveraging the power of AJAX and JSON to showcase dynamic HTML content pulled from PHP

I'm working on retrieving data from my PHP file, and it contains information in the columns Email, FirstName, LastName, and State. $query = 'SELECT * FROM users WHERE LOWER(Email) = :email'; $stmt = $dbh->prepare($query); $stmt->bindV ...

Utilizing DataTables.Net Editor for AJAX data submissions within a C# MVC controller

Hello there, I am currently utilizing the Datatables.net editor jQuery plugin in a C# project. I have a question regarding grabbing the data/value of keyLastName from an AJAX post in order to add it to the Editor's WHERE clause within an MVC Controlle ...

Inquiry about jq_link_to_remote() in Symfony

I have a unique template that displays a dialog when a link is clicked: <div id="myDialog"> </div> echo jq_link_to_remote('Click here to send a message', array( 'url' => 'me ...

Validate if the Jquery AJAX response contains any data

I've been attempting to integrate an alert message in my code that triggers if the response is null, but every time I try to do so, something goes wrong. If anyone has any suggestions or assistance with this issue, it would be greatly appreciated. He ...

Enabling a read-only textbox based on dropdown list selection without requiring a postback

How can I dynamically make a textbox read-only when a specific option is selected in a combo box, without causing the web page to reload? I'm designing a sickness form where I want certain text boxes to become read-only if the user selects that they h ...