Position on the chart in the Highcharts

I have developed 2 highcharts in the code below:

<div>
   <p id="container">
   </p>
   <p id="cont">
   </p>

   </div>

I specified the width and height as follows:

 $('#cont').highcharts({
            chart: {
                width: 500,
                height: 300,

                type: 'pie',
                options3d: {
                    enabled: true,
                    alpha: 45
                }
            },

The "cont" chart is positioned below the "container" chart, but I want both charts to be on the same line. See image for reference:

https://i.sstatic.net/bUpHZ.png

Additionally, I would like to know how to add a border to the charts.

Answer №1

The Highcharts website showcases an impressive example of an angular gauge demo, demonstrating how to achieve this.

Within their code, the <div> elements are structured and styled as follows:

<div style="width: 600px; height: 400px; margin: 0 auto">
    <div id="container-speed" style="width: 300px; height: 200px; float: left"></div>
    <div id="container-rpm" style="width: 300px; height: 200px; float: left"></div>
</div>

Visual representation can be viewed here:

https://i.sstatic.net/2Qb7e.png

To add a border to your charts, you can modify the code like this:

    chart: {
        type: 'solidgauge',
        borderColor: 'red',
        borderWidth: 1
    },

This modification will result in visually altered charts:

https://i.sstatic.net/KJMRu.png

For further insights into adjusting appearance options for the chart such as border radius and background color, refer to the API documentation: http://api.highcharts.com/highcharts#chart

I trust this information proves valuable.

Answer №2

<p> is considered a block element, and should always come after the previous element. To ensure they fit on one line, consider using <span> instead of <p>. You can adjust the sizes of the spans as needed:

<div>
  <span id="container">
  </span>
  <span id="cont">
  </span>
</div>

Then in your CSS:

span#container {
  width: 50%;
  border: 1px solid black;
}
span#cont {
  width: 50%;
  border: 1px solid black;
}

Answer №3

To enhance the presentation, it is recommended to either segregate both charts or apply CSS styling.

.highcharts-container{float:left;width:500px}

or

.container{float:left;width:500px}

This approach will assist you in achieving a better layout.

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

Executing PHP code upon clicking an HTML button

I am currently in the process of creating a simple webpage that will execute a stress test and mimic a load on my web server. The PHP code for stress is functioning properly, however, when I attempt to click the button, nothing seems to happen. <?php ...

Change the CSS property to override the text-overflow with ellipsis

In my specific scenario, I need to override the default ellipsis behavior that adds '...' to text when using 'text-overflow: ellipsis', and instead use two stars **. Is there a way to achieve this using only Pure CSS? It is important t ...

Guiding you to choose a specific child class by identifying its parent class in CSS and jQuery

Hey there! I'm currently working on a website that allows users to post content. I want to ensure that the site is mobile-friendly, so I need to make some adjustments with media queries. Unfortunately, I've run into an issue where media query CS ...

Delete the right-hand p-timeline-event-opposite margin from the Angular 17 PrimeNG Timeline

I am currently utilizing the PrimeNG Timeline module to showcase a few straightforward horizontal timelines with content placed on the top side in a table format. How can I eliminate the space allocated by the .p-timeline-event-opposite section? Upon inspe ...

React and SASS - issue with checkbox component not being properly aligned with its label

I'm brand new to React and I'm currently in the process of converting a pure HTML page into a React component. How can I adjust the SASS stylesheet to match the original HTML layout? Here is my current React setup (the checkbox displays on the r ...

Display a popover when the button is clicked using jQuery

Is there a way to show a notification message using popover? I've managed to make it work, but I'm facing an issue where the popover doesn't appear on the first click of a button after the page loads. Here is the code snippet: <button ty ...

Is the table not displaying properly in the print preview with a messy

I have a large table with multiple rows. Due to its length, I have provided a link to the jsfiddle where you can view it: jsfiddle. The table is structured in HTML and contains many rows with various attributes. <table> <thead>text here!</t ...

Transmit data from the Windows Communication Foundation to JavaScript

Looking to invoke the WCF service through JavaScript, utilizing AJAX? Check out this resource: Calling WCF Services using jQuery Here's my query: Is there a method to retain some JavaScript-related data after making a request, and then transmit inf ...

Select a specific element to apply a CSS selector for a button

One of the challenges I am facing involves a webpage with multiple submit buttons. My goal is to iterate through each button and click on them one by one. While I am aware that this can be achieved using xpath like this (//button[@class='submit' ...

What's the best way to align text at the center of this DIV?

I recently created a small offline website with a header that includes a logo, navigation bar, and notification bar. While I managed to align everything as intended, I encountered an issue with the text alignment within the notification bar (header-alert). ...

Is it achievable to create shadows that do not overlap?

When you hover your mouse over the pill-shaped object, it should smoothly move over the circle as desired. However, the shadow of the circle still remains visible creating an unwanted effect. I am looking for a solution where the shadows do not overlap but ...

Error during compilation due to a missing parenthesis in the loop structure

I've been experimenting with creating a carousel using just html and css, without any Javascript. I've been exploring resources on the web and following tutorials to achieve this goal. However, I've encountered an issue. I created a mixin l ...

JavaScript and Responsive Design Techniques

I'm struggling to create a responsive page that starts with a mobile-first approach, but I keep running into the same issue. When I have my dropdown menu in the mobile version, it looks good. However, when I try to switch it to the non-mobile version ...

Best Practices for Integrating PHP Code into an HTML File for Contact Form Placement

My current setup involves an html file named index.html, which contains the code for my contact form fields such as name and email. Is there a way to include PHP code in this file without converting it to index.php? ...

Icon button with label positioned underneath - utilizing Font Awesome icons

I am looking to design a button that features a Font Awesome icon with text below it for a navigation menu. The goal is to achieve a layout similar to the icons found in the Microsoft ribbon. Additionally, I want to include an arrow below the button (simi ...

Choosing the initial hyperlink provided by a search engine like Google

While examining the google search website, I can easily locate my desired href by searching for //div[@class="r"]/a/@href using the finder tool. However, when I attempt to access it with scrapy using response.xpath('//div[@class="r"]/a/@href'), I ...

Newbie inquiries regarding the process of migrating a CRUD application to PhalconPHP

I have recently delved into using PhalconPHP 1.3.1 for an application related to my master's thesis. While it is still a work in progress, I am currently focusing on implementing CRUD functionality and refining the user interface. This endeavor marks ...

Retrieve the HTML content from the string that is returned

I have the string containing a list structure in my code-behind file: string xmlContents = "<ul><li>Installation<br /><ul><li>Startup</li><li>Getting there</li><li>Steps</li>" + ...

Double Marker Challenge in Brochure

I am currently using Leaflet in conjunction with VueJs. I have encountered an issue where a double marker is appearing at a specific location when I add a marker: The code responsible for this behavior is as follows: mounted() { this.map = L.ma ...

Showing a placeholder image in the absence of any image

I need help with displaying a default image when there is no uploaded image in the CMS. Here is the code I have so far: <li><img alt="" class="img-responsive" src=" <? if($artikel[0]['images'] == '' ...