What are some effective techniques for working with data in d3/Canvas JS?

In my work on a visualization dashboard, I am currently facing some challenges.

I am torn between choosing d3js and canvasjs. While d3js offers great visuals and rich functionality, I lean towards canvas because of how easy it is to create charts. If you have any insights on how I can decide between the two, please share.

Purpose: My goal is to build an interactive dashboard with numerous cross filters for visual representations. Do you have any suggestions? Regarding data retrieval from API; should I fetch all data from the server and process it in JavaScript, or should I retrieve data separately for each chart?

If I pull all the combined data from the database, the size exceeds 2 MB which is too large for a dashboard. On the other hand, fetching precise data for individual charts results in less data. An example would clarify this dilemma further.

Imagine I have sales data with multiple columns linked from various tables, and my dashboard features four charts:

chart 1: Bar chart for sales by item group 
chart 2: Pie chart for sales by salesperson
chart 3: Line graph showing sales by hours (weekdays): shop sales trend
chart 4: Total Sales, Total Orders KPI

Data Collection: I can either obtain data separately for each chart through REST API or retrieve all joined table data at once (larger than 2 MB).

Interactivity: When I click on an item group in chart 1 (bar chart), I want the rest of the charts to filter accordingly (I'm considering writing a JS filtering code).

What approach should I take for data retrieval and cross-filtering?

Addressing the above query may lead to more questions.

Thank you.

Answer №1

  1. CanvasJs offers a unique way of creating charts by utilizing the canvas element in HTML5, while D3 makes use of svg. The advantage of using CanvasJs is its quick response time, which allows for fast rendering compared to D3. If you prioritize speed and do not require extensive data manipulation, then CanvasJs may be the better option for you.
  2. D3, on the other hand, excels at filtering charts based on specific criteria, making it ideal for cases where filters are necessary. For instance, when working with sales data, having the ability to apply filters that reflect changes across multiple charts can be invaluable. D3's crossfilters feature enables users to easily filter out relevant information and update linked charts accordingly.
  3. Both Canvas and D3 support data in a variety of formats including Arrays, JSON, and CSV.

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

Deliver compressed data in gzip format from a Node.js server to the client using socket.io

I am currently facing an issue regarding determining whether the data being sent back to the client is compressed in gzip format or not. Upon examining my server's output from the command line, I notice the following: debug - websocket writing 3:::{" ...

Unable to include checkout and clear cart buttons in popover within bootstrap 5

I am currently working with BootStrap version 5.0.0 beta-2 and facing an issue when attempting to dynamically add a button within my popover. I have ensured that the scripts are included in the following order: <script src="https://ajax.googleapis. ...

The event failed to initiate

I have an event that is fired when the number value changes in the <input type="number"> below: <input type="number" inputmode="numeric" pattern="[0-9]*" size="4" class="lorem" value="0" step="1"> <input type="button" class="minus" value=" ...

Enhancing user experience with VideoJS player overlay buttons on mobile devices

I am currently using VideoJs player version 4.2. When I launch a videojs player on Safari browser in an iOS device, it defaults to native controls. However, when I pause the player, overlay buttons (links to navigate to other pages) are displayed on the v ...

Why is it that my JQuery sliders appear perfectly fine when viewed locally, but fail to show up when accessed on

I'm facing an issue with two JQuery sliders on my page. The local version works fine, but when I upload it to my web host, only one slider functions correctly. I need both of them to work as intended. Any insights on how to resolve this problem? See ...

The URL for the Javascript chunk includes colons at https://example.com/js/chunk-vendors.b3792e11.js:18:16400

I recently completed a Vue application and used npm run build to generate the files. Upon uploading the dist folder to my Apache server, I encountered an issue where Apache was unable to locate the file when trying to access a specific part of the app (:18 ...

Attributes of the host element in Angular 1.5 components

I am seeking a way to customize attributes on the host element for Angular 1.5 components. What is the purpose? I would like to assign a class to a component in order to apply specific styles. For example, if the parent component has display: flex set, ...

Is there a way to remove createdAt and updatedAt from every query in Sequelize?

Currently, I am utilizing Node 14 and Sequelize to model an existing Postgres database. The tables that have already been created do not contain the createdAt or updatedAt columns, so my intention is to set up Sequelize in a way that it will never attempt ...

Transform JSON information into an array

element below, I am facing a challenge. I need to convert the JSON format provided into an array format as shown in the second code block: [ { "Latitude": "-7.00786", "Longitude": "34.99805", "UserID": 0, "HTMLCode": "& ...

A guide to showcasing JSON data on a webpage using JavaScript

I am currently working on a SOAP WSDL invocation application in MobileFirst. The response I receive from the SOAP WSDL is in JSON format and is stored in the result variable. When trying to access the length of the response using result.length, I encounter ...

Encountering an issue with Angular 5.2 application build on VSTS build server: Running into "CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory" error

Out of nowhere, the builds began failing with the following error : 2019-01-03T12:57:22.2223175Z EXEC : FATAL error : CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory error MSB3073: The command "node node_modules/webpack/bin/w ...

When should you opt for a plugin over a traditional module in Fastify?

I am uncertain about the best practices for using plugins in Fastify.js. For instance, if I have a lib/utils.js file containing utility functions, my usual approach would be to simply require() them wherever necessary in my app. What advantages are there ...

Tips on extracting a value from a JSON response

After calling my controller, I receive the JSON result below {"data":"Monday"} The data retrieved can be any day of the week (Sunday, Monday, etc...) If the call is successful, I intend to execute this in the AJAX call success: function(Response){ ...

Tips for modifying the value of a JSON object using Javascript or Jquery

I am looking to retrieve the value of a specific key, potentially accessing nested values as well. For example, changing the value of "key1" to "value100" or "key11" to "value111. { "key1": "value1", "key2": "value2", ...

JavaScript switch statement and case expression

Struggling to use boolean expressions within a switch statement to search for undefined values and manually change them. When using an if statement, the process is easier. For example: if statement if(Item1 == undefined) { item1 = "No"; } else if (Item ...

Is it possible to transfer a child from one parent to another using JavaScript?

I need help with moving an element from one parent to another using JavaScript, preferably using the jQuery library. Original code: <div id = "div1"> <p id = "paragraph"> Lorem ipsum dolor sit amet, adipiscing pellentesque egestas. &l ...

Stop the submission process by deactivating the button until a selection is made

Is there a way to prevent the submit button from being clicked until the user has selected or typed at least one value? <form name="forma" method="POST" action="used-results.php" id="apliforma"> many textboxes and dropdown menus <a oncli ...

The onchange tag fails to trigger my Javascript function when selected

Here is the code I have: JS: function updateLink() { var selType = document.getElementByID("Types"); var selLen = document.getElementByID("Length"); var selLoc = document.getElementByID ...

Deactivating the submit button after a single click without compromising the form's functionality

In the past, I have posed this question without receiving a satisfactory solution. On my quiz website, I have four radio buttons for answer options. Upon clicking the submit button, a PHP script determines if the answer is accurate. My goal is to disable t ...

The date selector is failing to accurately reflect changes in the date objects

I've integrated a date-time picker from this source https://github.com/DanielYKPan/date-time-picker to manage 'beginning' and 'end' date objects (refer to selectedMoments in the TypeScript code) for a date selector. However, when I ...