Error 14 is occurring when attempting to use string values for the categories on the Highcharts

Starting right away, here's the requested chart using ChartJS. We have two x-axes. One displays power from a meter and the other displays meter state over time (open, closed, or in standby). Both datasets use Unix time on the X axis. The Y axis for power is numerical, while the state X axis falls into one of three categories. Both datasets are represented with lines. https://i.sstatic.net/rvUJ1.png

To cut to the chase: How can I achieve this with Highcharts? I already have the second axis set up:

        xAxis: {
          type: 'datetime'
        },
        yAxis: [
          {
            title: {
              text: 'Real Power'
            }
          },
          {
            type: 'category', //I have also removed this line 
            title: {
              text: 'state'
            },
            categories: ['closed', 'standby', 'open']
          }
        ],

Any attempt to make the Y axis value a string in Highcharts leads to a familiar error: https://www.highcharts.com/errors/14/

Additionally, it seems that online resources only focus on categories for the X axis. Any guidance on how to accomplish this task would be greatly appreciated. Thank you in advance.

Answer №1

It's important to note that a string cannot be used as the x value; instead, a number should be used. For instance:

    series: [{
        ...
    }, {
        ...,
        yAxis: 1,
        data: [1, 0, 2, 1]
    }],
    yAxis: [{
        ...
    }, {
        title: {
            text: 'status'
        },
        categories: ['active', 'inactive', 'pending'],
        min: 0,
        max: 2
    }]

Check out this live demo: http://jsfiddle.net/BlackLabel/o7Lvyadm/

For more information, visit the API Reference: https://api.highcharts.com/highcharts/yAxis

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

``In search of a solution: Resolving the Error Message "Dropzone already attached

Whenever I try to upload an image successfully, I need to execute the editDataImage() function in order to fetch the data stored on the server. However, I encounter an error when attempting to display the image data in the dropzone. Any assistance would be ...

AngularJS withCredentials Issue causing data not to be transmitted

When using AngularJS, I encountered an issue where the cookie/session was not being shared across domains for my Restful API in a subdomain. To address this problem in Angular, I added the following configuration: app.config(['$httpProvider', fu ...

Fill a popup window with data retrieved from a MySQL query result

I have created an HTML page that displays data retrieved from a MySQL database. Users have the option to edit records, and I want to implement a modal form that opens up and shows data related to a specific "id" from the database when the edit button is cl ...

I possess a list of unique identifiers and require the ability to either update an existing object within an array contained in a MongoDB document, if it exists,

I am facing a challenge in updating a specific element within an array in a MongoDB document. I have multiple IDs of that array and need to update the matching element using those IDs. data= [ { "planId" : "plan_FVNvrmjWT7fRDY", "startTime": ...

Revamping the Look: Refreshing Background of Div

I'm attempting to change the background image of the body element on a webpage when I hover over links with data-* attributes. It's working perfectly, but I can't seem to figure out how to create a smooth fade between the images when a link ...

Comparing C pointers to logging in JavaScript

I have been attempting to transform this C function into a JavaScript class: for(i=0; i<inputLen; i++) { //Calculate the constants pucSeqX = m_pucSeqX; pucSeqM = m_pucSeqM; for(j=0; j<m_iRounds; j++) { *(pucSeqX++) = arc4 ...

Updating a property on an object during iteration

Currently, I am in the process of developing a Single Page Application using Laravel on the backend and Vue.js. I have two arrays that are crucial to my project: The first array is accessArray: ["BIU","CEO","Finance","HRD","Group"] The second array is a ...

Implementing a clickable image using an anchor tag in JavaScript

I need to enhance my image tag in JQuery by adding an anchor tag alongside it. How can I accomplish this using JavaScript? Here is what I attempted: var imgg = document.createElement("img"); imgg.className='myclass'; $( ".myclass" ).add( "<a ...

Is there a way to retrieve the zoom level in Highmaps and are there any events related to zooming in Highmaps

Is there a way to trigger a zoom event in Highmaps? Furthermore, how can the current zoom level of the map be retrieved? Adjusting the zoom level is straightforward, but extracting it proves to be more challenging. After exploring the API documentation, ...

Retrieve the document id along with the corresponding data from a collection

Retrieving data from the collection leads and displaying all documents in an HTML table. Upon clicking, I need to extract the document ID of the clicked item as it serves as the sole primary key. P.S I am able to obtain records of all documents in an arra ...

The Router.use() function in Node JS for Json web tokens requires a middleware function, however it received an undefined

Trying to implement a login feature in Node JS using JSON tokens, I have written the following code in server.js: // dependencies var express = require('express'); var app = express(); var bodyParser = require('body-parser'); var mor ...

Making HTTP requests to the Gmail API

Today, I dedicated most of my time to learning how to utilize the Gmail API with node.js. Following Google's QuickStart guide, I successfully got the API up and running fairly quickly. It seemed like there were two methods for making API requests. One ...

Tips for restricting camera movement in threejs

Being new to working with threejs, I am struggling to set limits on the camera position within my scene. When using OrbitControls, I noticed that there are no restrictions on how far I can zoom in or out, which I would like to change. Ideally, I want the c ...

Generate a PDF document on the user's device

Is there a way for me to trigger the print command on a PDF file without relying on Adobe PDF viewer's print button? I'm interested in using a separate event instead of the print button within the PDF viewer. Is this achievable? ...

Using react hooks, I am refreshing the product image by replacing it with the thumbnail image

I'm currently working on an e-commerce platform that resembles Amazon. In the product detail page, I want the right side image to update when I click on a thumbnail image on the left side. The issue I'm facing is that upon first loading, the def ...

Unable to retrieve injected AngularJS services when inside a function within a controller

The $scope and Food variables are inaccessible within the destroy function. foodProject.controller('FoodsCtrl', function($scope, Food) { $scope.foods = Food.index(); $scope.destroy = function(food){ debugger; console.log ...

Generate individual div containers and populate them with content from specific files using an ajax request

Hey there! I'm grappling with the code below, which is supposed to iterate through a directory of HTML files. Each file should be loaded into its own div with the class ".module". While my code successfully retrieves the directory and file names, it&a ...

Jenkins encountered an issue where script execution was blocked on <URL> due to the document's frame being sandboxed without the 'allow-scripts' permission set

When using an iFrame in HTML, it's always best to remember to sandbox it and set the 'allow-scripts' permission to true. However, I'm facing an issue in my pure Angular JS application where there is no iFrame present. It runs smoothly ...

Error message: The call stack size has surpassed the limit, resulting in a RangeError. This issue is

I currently have a dynamic unordered list within my HTML file. Upon loading the page, certain list items are automatically added. The original format of the list is displayed as follows: <ul class="ui-front"> <li><div>1</div& ...

Exploring Vue's reactivity using the composition API and cloning props

In my current component setup, I am receiving props from a parent. However, I am facing an issue where I only want to clone these props without any changes affecting the parent component. <template> <input-text v-model="form.name" /&g ...