HarmonyOS Chart Libraries in 2026: A Practical Comparison

0 阅读4分钟

The native option discussed here is @mcui/mccharts 3.0.0: a HarmonyOS chart component built on the Apache ECharts 6.1.0 option model and rendered through native GLES without a WebView. It is published on OHPM (ohpm install @mcui/mccharts@3.0.0).

Choosing a chart solution is easy if the requirement is “show three bars.” It gets harder when the same page must update live data, fit inside a scrolling ArkUI screen, respond to touch, and export an image with readable labels.

There are several ways to build that page: use a HarmonyOS chart component such as @mcui/mccharts, draw the chart yourself with ArkUI Canvas, or embed an existing web chart in a Web component. These are different integration routes. The useful comparison is what each route asks your team to build and verify for the actual product.

A chart from the mccharts HarmonyOS demo

Begin with the job, not the list of chart types

Suppose a store dashboard needs a daily sales line, a date filter, a tappable point, and an export button. The chart must also return to the same page after the user opens an order detail. All three approaches can start with the same data, but they distribute the work differently.

Questionmccharts componentCustom ArkUI CanvasExisting web chart in Web
Who builds axes and chart behavior?The component and its chart runtime, within supported featuresYour application or a chart library you build onThe web chart and page you embed
Page integrationArkUI component, options and callbacksArkUI drawing plus your own state and input handlingWeb page plus bridge and lifecycle handling
Rich HTML inside the chartNative tooltip path has no browser DOMYou must build any complex panel in the appAn existing page may use HTML; check its bridge and security model
ExportCurrent V2 native Surface PNG path, then app handles storage/shareYou implement the desired capture/export pathDepends on the embedded web page and application integration
Best evidenceTarget HAR, SDK, device and feature checksTarget Canvas implementation and device checksActual web page, Web integration and device checks

The table describes the integration work, not a speed ranking. HarmonyOS provides an ArkUI Canvas drawing API, and its Web component has its own application integration model. Neither automatically supplies the business behavior around a chart.

What does the mccharts route look like?

At the page boundary, the caller prepares an Options object and supplies layout space:

import { McChartsV2 } from '@mcui/mccharts';
import type { Options } from '@mcui/mccharts';

@Entry
@ComponentV2
struct SalesComparisonPage {
  private option: Options = {
    animation: false,
    tooltip: { trigger: 'item', renderMode: 'richText' },
    xAxis: { type: 'category', data: ['Mon', 'Tue', 'Wed'] },
    yAxis: { type: 'value', min: 0, name: 'Orders' },
    series: [{ id: 'orders', name: 'Orders', type: 'line', data: [12, 18, 15] }]
  };

  build() {
    Column() {
      McChartsV2({ options: this.option }).width('100%').height(320)
    }.width('100%').padding(16)
  }
}

This is intentionally small. A real dashboard still needs loading and empty states, correct business IDs, error handling and a decision about what to keep when the date filter changes.

Inside the component, the chart session waits for the native host and a usable size. The source contains the guard:

if (!this.attached || this.controllerBindingFailed || !this.loaded || this.runtime || this.options === undefined || this.width <= 0 || this.height <= 0) { return; }

That is one concrete thing to compare: how each solution connects data, layout and readiness. If the card has no height, changing the color of a series cannot make the native surface usable.

What happens when the user taps?

For mccharts, onChartClick reports a series click; onMarkerClick reports a marker. Their indexes are not interchangeable. An application still needs a mapping from the currently displayed series data to business records. If it filters and sorts an array before passing it to the chart, the mapping must follow that same order.

With custom Canvas, the team must decide how hit testing works: translate a touch coordinate into the plotted area, find the relevant data, and account for zoom and clipping. A web page may already have click handling, but a native app still needs to decide what information crosses the bridge and how the page behaves when the app goes to the background.

That difference often matters more than whether all three can draw a blue line. Test the exact interaction the user needs: tap a point, change the filter, tap again, leave the page and return. If a library has a demo but no verified mapping for your filtered data, the feature is not yet proven for your screen.

A fair comparison uses the same workload

Pick a representative dataset and record the following before measuring:

  1. Device model, system, SDK and exact package versions.
  2. Number of charts, series, data points and visible points.
  3. Chart size, animation settings, labels and interaction requirements.
  4. Data preparation, first display, update, zoom and return-to-page actions.
  5. Measurement tool and what each number includes.

For example, a JavaScript setOption duration measures a call, not necessarily the time until the last pixel is visible. A native runtime frame-generation measurement does not include the whole device GPU and screen pipeline. Keep data processing, rendering and user-visible timing separate.

Keep comparison inputs and observations aligned

Do not draw conclusions from one screenshot or assume a native path must be faster. A small custom plot might be simpler and faster to maintain with Canvas; an existing web report with complex HTML may be expensive to rewrite; a component integrated with ArkUI may suit a page that needs native state, gestures and export. Verify each claim with the same device and workload.

Questions to ask before choosing

For any package, inspect the actual version, license materials, maintenance history, target ABI, SDK compatibility, supported features and failure diagnostics. A package name appearing in a registry is not proof that a particular version can handle your chart or device.

Try the hardest representative screen first. Include a long label, missing values, a data update and a real tap. If the app needs export, check the final image, not only a promise returned by an API. If it needs 100,000 samples, record both the total and the visible window, then measure the complete operation on the target device.

The best choice is the one your team can integrate, explain and maintain under those conditions. A feature list is a starting point; the page your users actually operate is the test that matters.