Questera AI
  • Getting Started
    • Get Started with Questera AI
      • Overview of Questera
      • Why Choose Questera ?
      • Key Features & Benefits
      • How does it work?
    • Use Cases
      • Ecommerce & Retail
      • Saas
      • Subscriptions
  • Questera AI Platform
    • Data
      • Connect Data & Models
        • Data Ingestion
          • Snowflake
          • Amazon Redshift
          • Google BigQuery
          • Microsoft Azure
          • CSV
          • ESP (Email Service Provider)
          • CRM
        • Configure Models
          • Open AI
          • Gemini
      • Track & Measurements
        • Events
        • User Attributes
        • Counters
        • Metrics
        • Webhooks & Alerts
        • Feature Flags
    • Campaigns
      • Channels Supported in Questera
        • UI Campaigns
        • Email Campaigns
        • SMS Campaigns
        • Push Notifications Campaigns
        • In-App Messages Campaigns
        • WhatsApp Campaigns
      • Campaigns in Questera: Drive Growth Across Every Touchpoint
      • Omnichannel Marketing with Questera AI
      • Why Questera’s AI-Driven Approach Wins?
    • AI Audience Segments
    • Page
    • AI Variants
    • AI Flows
    • AI Agents
      • What are AI Agents?
      • Types of AI Agents
        • ELMA - Email Lifecycle Marketing Agent
        • GRETA - Growth Engineering Agent
        • SEGA - Intelligent Segmentation Agent
        • OMNIA - Omni-Channel Journey Creator Agent
        • GIA - Data Analysis & Graphical Interpretation Agent
        • SARA - Smart Ads Retargeting Agent
        • BECCA - Personalized Email Content Agent
        • LEXA - Language Optimization Agent
      • Create & Configure an Agents
        • Create your own marketing agents
        • Chat with Agents
    • Analytics & Reporting
      • Analytics
        • Overview of Analytics.
          • Dashboard Walkthrough
          • Add dashboard
          • Chat with data
    • Playground
      • Simulating User Interactions.
        • Test and Run Campaigns
    • Dataset
      • Connecting an external data source
      • Uploading your own file
  • Questera AI SDKs
    • SDK Component Categories
      • Onboarding
      • Engagement
      • User Assistance
      • Expansion
      • Miscellaneous
    • All Components
      • Onboarding
        • Onboarding Quiz
        • Login Component
      • Gamified Engagement
        • Rewards & Loyalty Component
        • Challenges
        • Leaderboard
        • Badges
        • Spin The Wheel
        • Scratch The Card
        • Gamified Quiz
        • Streaks
        • Dynamic Membership
      • Education
        • User Guides
        • Tooltips
        • AI Help Hub & Assistant
      • Popups
        • Special Offers
        • Upsells & Cross Sells
        • Product Recommendations
        • Celebrations
        • Alerts
      • AI Search
      • User Feedback
      • Surveys
      • Referrals
      • Banners
      • Pricing & Payments
      • Embedded Analytics
    • React SDK Components
      • Onboarding
        • Onboarding Component
        • Get Started Component
        • Tutorial/Quest List Component
        • Walk Through Component
      • Gamification
        • Challenges Component
        • DailyStreak Component
        • Leaderboard Component
        • GamifiedQuiz component
      • User Assistance
        • Feedback Workflow Component
        • Inline Feedback Component
        • Survey Component
        • Search Bar Component
        • Help Hub Component
        • CreditsPopup Component
      • Expansion
        • Referral Components
        • Cross-Selling Component
      • Miscellaneous
        • Confetti Component
        • Alert Component
        • Login Component
        • One to one Survey Component
        • Pricing & Payment Component
        • Badge Component
        • Toast Service
      • Survey
        • User Experience Feedback Survey
        • Feature Usage Survey
        • Customer Satisfaction Surveyy
        • Net Promoter Score
        • Onboarding Experience Survey
        • Customer Support Satisfaction Survey
      • Embedded Analytics
        • Line Chart
        • Scatter Chart
        • Combo Bar/Line
        • Stacked Bar Chart
        • Horizontal Bar Chart
        • Stepped Line Chart
        • Pie chart
        • Doughnut Chart
        • Multi Series Pie
        • Bubble Chart
        • Floating Bar Chart
    • React Native SDK Components
      • Onboarding
        • Embedded Onboarding ToolTip
        • Announcement Banners
        • Onboarding Component
        • Get Started Component
        • Quest List Component
      • Gamification
        • Challenges Component
        • Daily Streak Component
        • Leaderboard Component
        • Quiz component
      • User Assistance
        • HelpHub
        • Feedback Workflow Component
        • General Feedback Component
        • Inline Feedback Component
        • Credits Popup Component
      • Expansion
        • Cross-Selling
        • Share With friends
        • Referral
      • Miscellaneous
        • Spotlight Searc
        • Modal
        • Login Component
        • Membership Card
        • Badges
        • Pricing
        • Survey Form
        • Banner
        • Carousel
        • Tutorial
        • Daily Check-in Credit
    • No Code SDK Components
      • HelpHub
      • Feedback Workflow Component
    • Flutter SDK Components
      • Onboarding
        • Onboarding Quiz - Multi page Component
        • Onboarding Quiz - Single page Component
        • Get Started Component
        • Tutorial/Quest List Component
      • User Assistance
        • Feedback Workflow
        • Help Hub Component
        • Inline Feedback Component
        • Spotlight Search Component
        • Survey component
      • Gamification
        • Daily Streak Component
        • Leaderboard Component
        • Gamified Quiz Component
      • Expansion
        • Referral Component
        • Cross-Selling Component
      • General Components
        • Login Component
    • Rest APIs
      • Data Module
        • Data Object
      • Entity Module
        • Entity Object
      • User Module
        • User Object
      • Gamification
        • Badge Object
        • Web3 Module
          • Dynamic NFT Object
        • Skills Module
          • Skills Object
        • Levels Module
          • Levels Object
  • Integrations
    • Email
      • Mailchimp
      • Klaviyo
      • Mailmodo
      • Mailjet
      • Brevo (SendInBlue)
      • Constant Contact
      • Elastic Email
      • ApolloIo
      • Google OAuth
      • Instantly
      • Loops
      • AWS SES
      • SendGrid
      • Hubspot
      • Activecampaign
      • One Signal
      • Attio
    • Customer data platforms
      • Segment
      • Shopify
      • Salesforce
    • Workflow automation & ETLs
      • Zapier
    • Analytics & business intelligence
      • Mixpanel
      • Amplitude
      • Heap
      • Posthog
      • Snowflake
      • Google BigQuery
      • Clay
      • Outreach
      • Salesloft
      • Smartlead
    • Data ware house
      • Redshift
      • Microsoft Azure
    • Task management
      • Clickup
      • Jira
    • Engagement Platforms
      • Braze
      • Moengage
      • Iterable
      • Customer.io
    • Segment
      • Overview
      • Sending Data to Segment
      • Sending Data to Questera
    • In-App UI
      • Quest UI SDKs
      • Pendo
      • Appcues
      • Bubble
      • Chameleon
    • FAQ
  • recipes
    • Greta
      • SaaS Subscription
        • Activation
        • Conversion
        • Retention
      • SaaS Credit-Based
        • Activation
        • Conversion
        • Retention
        • Engagement
      • Ed-Tech
        • Activation
        • Conversion
        • Retention
        • Engagement
      • Gaming Apps
        • Activation
        • Conversion
        • Retention
        • Engagement
      • E-Commerce
        • Activation
        • Conversion
        • Retention
    • Elma
      • SaaS Subscription
        • Activation
        • Conversion
        • Retention
        • Engagement
      • SaaS Credit-Based
        • Activation
        • Conversion
        • Retention
        • Engagement
      • E-Commerce
        • Activation
        • Conversion
        • Retention
        • Engagement
  • Quest Tools
    • Saas GPT
    • Playground
    • PLGOS
  • GRETA
    • How to create your first project using Greta?
    • Playground
Powered by GitBook
On this page
  • Component Visuals
  • Installation
  • Features
  • Props
  • Types
  • Usage
  • Example Usage
  • Demo
  1. Questera AI SDKs
  2. React SDK Components
  3. Embedded Analytics

Stepped Line Chart

Analyze step-by-step engagement changes, feature adoption, and benchmark achievements to boost activity, promote lesser-used functionalities, and enhance performance.

PreviousHorizontal Bar ChartNextPie chart

Last updated 9 months ago

Component Visuals

Installation

To use the Chart component, you need to install the Quest Labs React SDK:

  • Open your terminal/command prompt.

  • Navigate to your project's root directory using the cd command if you're not already there.

  • Run the following command to install the quest-sdk package using npm:

npm install @questlabs/react-graphs

This command will download and install the package and its dependencies into your project.

Note: The Quest Labs React Graph SDK includes ECharts as a dependency. When you install @questlabs/react-graphs, ECharts will be automatically installed as well. ECharts is a powerful charting library used by the Quest Labs SDK to render various types of charts, including the Chart.Line component.

Make sure your project has npm and Node.js installed, and that you have the necessary permissions to install packages in your project directory.

Features

The Chart.Line component from Quest Labs SDK offers powerful features for creating interactive and visually appealing line charts in your React applications:

  • Theme Support: Customize the appearance of the line chart using themes. Themes allow you to define colors, fonts, and other visual properties to match your application's design system.

  • Data-driven: Visualize data easily with the Chart.Line component by providing an array of data points. Each data point consists of x and y coordinates, enabling you to display trends and patterns over time or other variables.

  • Tooltip Integration: Easily add tooltips to display additional information when users hover over data points. Tooltips enhance interactivity and provide contextual details about data values.

  • Event Callbacks: Utilize event callbacks such as onChartLoad, onChartLoaded, and onChartInitialized to handle chart loading states, data retrieval, and initialization. These callbacks help manage chart lifecycle events efficiently.

  • React Integration: Built with React in mind, the Chart.Line component integrates smoothly into React applications. It leverages React's state management and component lifecycle methods for efficient data handling and rendering.

Props

Chart component props

Prop Name
Type
Required
Details

children

JSX.Element | JSX.Element[]

No

The children components to be rendered inside the chart container.

chartId

string

No

The unique identifier for the chart. Generated through QuestApp.

theme

object

No

The theme configuration for the chart.

data

LineChartDataset[]

No

The dataset for the chart. Each data object should follow the ChartDataset type structure.

setData

function

No

The function to set the dataset. It can accept SetStateAction for various chart datasets.

onChartInitialized

function

No

Callback function invoked when the chart is initialized.

onChartLoaded

function

No

Callback function invoked when the chart data is loaded. Optional parameter for the loaded data.

onChartLoad

function

No

Callback function invoked when the chart starts loading.

height

string | number

No

The height of the chart container.

width

string | number

No

The width of the chart container.

Chart.Line component props

Prop Name
Type
Required
Details

legend

object

No

The configuration for the chart legend, including position, formatter, icon, and text styles.

grid

object

No

The configuration for the chart grid, including position and label containment.

xAxis

Axis

No

The configuration for the x-axis, including type, visibility, formatter, and styles.

yAxis

Axis

No

The configuration for the y-axis, including type, visibility, formatter, and styles.

toolbox

object

No

The configuration for the toolbox component.

tooltip

object

No

The configuration for the tooltip, including styles and alignment options.

zoom

object

No

The configuration for zooming, including enabling wheel/slider zoom, start/end, and styles.

resizable

boolean

No

Whether the chart is resizable.

height

string | number

No

The height of the line chart container.

width

string | number

No

The width of the line chart container.

Types

type LineChartDataset = {
    id?: string;
    data: number[] | number[][];
    name?: string;
    cursor?: 'auto' | 'default' | 'pointer' | 'move' | 'text' | 'wait' | 'help' | 'not-allowed' | 'crosshair' | 'grab'| 'grabbing' | 'zoom-in' | 'zoom-out';
    extraData?: any;
    show?: boolean
    smooth?: boolean;
    showSymbol?: boolean;
    symbolStyle?: ItemStyle<StyleWithGradient> & {
        type?: 'rect' | 'roundRect' | 'circle';
        size?: number
    };
    lineStyle?: LineStyle;
    areaStyle?: ShadowStyle & Style & {origin?: 'start' | 'end' | 'auto'};
    step?: 'start' | 'middle' | 'end';
    emphasis?: Style & {
        lineStyle?: LineStyle;
        areaStyle?: ShadowStyle & Style & {origin?: 'start' | 'end' | 'auto'};
        scale?: number;
        label?: any;
        focus?: 'none' | 'self' | 'series'
    };
    animationDelay?: number;
    animationDuration?: number;
    animationEasing?: "backIn" | "backInOut" | "backOut" | "bounceIn" | "bounceInOut" | "bounceOut" | "circularIn" | "circularInOut" | "circularOut" | "cubicIn" | "cubicInOut" | "cubicOut" | "quinticIn" | "quinticInOut" | "quinticOut" | "sinusoidalIn" | "sinusoidalInOut" | "sinusoidalOut" | "elasticInOut" | "elasticout" | "exponentialIn" | "exponentialInOut" | "exponentialOut" | "linear" | "quadraticIn" | "quadraticInOut" | "quadraticout" | "quarticIn" | "quarticInOut" | "quarticout";
}

type Axis = {
    type?: 'time' | 'category' | 'log' | 'value';
    show?: boolean;
    formatter?: string | ((param: string) => string);
    showSplitLine?: boolean;
    showAxisLine?: boolean;
    splitLineStyle?: LineStyle;
    axisLineStyle?: LineStyle;
    labelStyle?: FontStyle & TextBorderStyle & TextShadowStyle & {
        fontFamily?: string;
        fontSize?: number | string;
        fontWeight?: 'bold' | 'bolder' | 'lighter' | 'normal';
        fontStyle?: 'italic' | 'normal' | 'oblique';
        textBorderWidth?: number;
        textBorderColor?: string;
        textBorderType?: 'dashed' | 'dotted' | 'solid';
        textBorderDashOffset?: number;
        textShadowBlur?: number;
        textShadowColor?: string;
        textShadowOffsetX?: number;
        textShadowOffsetY?: number;
        margin?: number;
        align?: Align;
        verticalAlign?: 'bottom' | 'middle' | 'top';
        color?: string;
    },
    min?: number;
    max?: number;
    data?: string[] | number[];
    boundaryGap?: string | [string, string]
}

Usage

To integrate the Chart.Line component into your React application, follow these steps

  • Import the CSS: In your JavaScript or TypeScript file where you're using the Chart.Line, import the CSS styles for the component. This ensures that the component's styling is applied correctly.

import '@questlabs/react-graphs/dist/style.css'
  • Import the Chart Component: Import the Chartcomponent from the @questlabs/react-graphs package.

import { Chart } from '@questlabs/react-graphs';

Example Usage

Here's an example of how to use the Chart.Line component within your React application.

import { Chart } from '@questlabs/react-graphs';
import type { LineChartDataset } from '@questlabs/react-graphs';
import '@questlabs/react-graphs/dist/style.css'

const lineChartData: LineChartDataset[] = [
  {
    name: 'Online Sales',
    data: [-20, -40, -20, -40, -60, -40, -20],
    symbolStyle: {
      color: 'rgba(101, 37, 179, 1)'
    },
    step: 'start'
  }
]

function App() {

  return (
    <div style={{display: 'grid', placeItems: 'center', height: '100vh', background: 'whitesmoke'}}>
      <Chart data={lineChartData} style={{width: 400}}>
        <Chart.Header>
          <Chart.Title>
            Step Chart
          </Chart.Title>
          <Chart.Option onSelect={console.log}>
            <Chart.Item label="Last 90 days" value="LAST_90D" />
            <Chart.Item label="Last 90 days" value="LAST_90D" />
          </Chart.Option>
          <Chart.Info>
            This is my line chart component
          </Chart.Info>
        </Chart.Header>
        <div style={{ padding: '10px 20px', display: 'flex', gap: 10 }}>
          <Chart.DatePicker value="03-05-2020" label="Start Date" />
          <Chart.DatePicker value="03-05-2024" label="End Date" />
        </div>
        <Chart.Line xAxis={{ data: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'] }}/>
        <Chart.Footer />
      </Chart>
    </div>
  );
}

You can fully customize the chart layout and use the useChart<ChartContextSingleType> hook provided by @questlabs/react-graphs. This hook provides various options.

type ChartContextSingleType<T extends ChartDataset> = {
    theme?: Record<string, string>;
    data: T[];
    setData: React.Dispatch<SetStateAction<T[]>>;
    loading: boolean;
    getChartId: () => string;
    setChartId: (chartId: string) => void;
    getQuery: () => string;
    setQuery: (queryString: string) => void;
    refetch: (props?: {chartId?: string, query?: string}) => Promise<T>;
    title?: string;
}

Demo

Check a demo video for better understanding.