Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@chartiq/react-components
Advanced tools
The ChartIQ React Components is a React component library featuring chart components that can be easily imported into an existing React application.
This package simplifies ChartIQ library use in the React framework. It requires ChartIQ library v8.6.0 or later.
If you do not have a copy of the library, please contact your account manager or send an email to info@cosaic.io or you may evaluate one from here.
Each component includes only the bare necessities to allow for maximum customization with the smallest size possible. To get started, we also include example components that come with ChartIQ's example files loaded.
After installing this package into your React project you will need to install the ChartIQ library (included separately).
npm install chartiq-8.6.0 // or whatever version you are using!
You can then import one of the included components into your React app:
import Chart from '@chartiq/react-components'
export default function MyChart() {
return <Chart />
}
Chart components use two primary props, config and resources, that allow them to be customized. The config describes how the chart should be set up, what addOns and plug-ins should be enabled, hotkeys, and more. Resources are passed to the chart and contain utilities that the chart should use, such as a quoteFeed or a storage constructor.
All components accept a config prop that can be modified to enable various features, set chart properties, load data, and more (for full documentation, see ChartIQ Default Chart Configuration).
Components require only parts of the default that requires customization, although full configuration can be provided as well. For example, to create a chart with an initial symbol of 'FB' instead of 'AAPL' use:
import Chart from @chartiq/react-components
export default function MyChart() {
return <Chart config={{ initialSymbol: 'FB' }} />
}
which creates a chart with an initial symbol of 'FB' instead of 'AAPL' (the initial symbol of the default configuration).
All components will load simulated data using the quoteFeedSimulator so that you have some working data to get started. When you are ready to add your own quotefeed, it should be aded to the resources prop passed into the chart component. The quote feed simulator can be disabled by setting quoteFeed
property in resources prop to a null
value.
import MyCustomQuotefeed from './myCustomQuotefeed'
<Chart resources={{ quoteFeed: MyCustomQuoteFeed }}}/>
Every component accepts children that it will render instead of its default JSX template. You can start by copying the Template.jsx file from the Chart/ directory to your own src/ directory and making changes.
import MyChartTemplate from './MyTemplate.jsx'
<Chart>
<MyChartTemplate />
</Chart>
The chart configuration includes the default Lookup.ChartIQ implementation, but you can substitute your own lookup driver to power symbol searches.
import Chart from '@chartiq/react-components'
import CustomSymbolLookup from './myCustomSymbolLookup'
<Chart config={{ lookupDriver: CustomSymbolLookup }} />
More information about Lookup Drivers can be found in the data integration ChartIQ Documentation.
The default configuration contains initialization for all add-ons (see config.addOns
) and filters that are enabled with the config.enabledAddOns
property. If you would like to disable an add-on, set the value in config.enabledAddOns
to null. For example, to disable the RangeSlider add-on:
import Chart from 'chartiq/react-components/Chart'
<Chart config={{ enabledAddOns: { rangeSlider: null } }} />
If you would like to pass custom configuration options to a specific add-on then you must pass the arguments to the config.addOns
property and make sure the add-on is included in the config.enabledAddOns
property. For example:
import Chart from 'chartiq/react-components/Chart'
const config = {
addOns: {
continuousZoom: {
periodicities: [
// daily interval data
{period: 1, interval: "month"},
{period: 1, interval: "week"},
{period: 1, interval: "day"},
],
boundaries: {
maxCandleWidth: 20,
minCandleWidth: 5
}
}
},
enabledAddOns: {
continousZoom: true
}
}
<Chart config={config} />
This configuration enables the continuous zoom add-on for daily data only with a custom boundary width.
ChartIQ comes with a variety of plug-ins that add enhanced functionality to charts. The default chart configuration contains entries to start plug-ins once they are imported.
Note: Plug-ins are optional extras that must be purchased. To determine the plug-ins included in your library, see the ./node_modules/chartiq/plugins folder.
The application includes the ChartIQ plug-ins as component resources that are enabled by uncommenting the relevant imports in the component resources file.
For example, to enable the Trade from Chart (TFC) plug-in for Core
Chart, uncomment the following lines in the ChartExample.jsx file in the ./src/Chart/ folder:
// import 'chartiq/plugins/tfc/tfc-loader';
// import 'chartiq/plugins/tfc/tfc-demo';
Changing the default properties of the plug-ins is also as simple as passing in the arguments you prefer when setting up the plug-in. For example, to configure the ActiveTrader plug-in without the orderbook
component and a custom height:
import Chart from '@chartiq/react-components/Chart'
import 'chartiq/js/plugins/activeTrader/cryptoiq'
const config = {
plugins: {
marketDepth: {
volume: true,
mountain: true,
step: true,
record: true,
height: "35%",
orderbook: false,
interaction: true
},
}
}
<Chart config={config} />
To enable the Market Depth chart and L2 Heat Map when using AdvancedChart
from Chart/Advanced inside your own component
#MyComponent.js
import Chart, { CIQ } from "@chartiq/react-components/Chart/Advanced"
import 'chartiq/plugins/activetrader/cryptoiq';
import 'chartiq/examples/feeds/L2_simulator'; /* for use with cryptoiq */
// Don't forget to turn on L2 data simulation!
function simulate({ chartEngine }) {
CIQ. simulateL2({ chartEngine, onInterval: 1000, onTrade: true });
}
export default function MyComponent() {
return <Chart chartInitialized={simulate} />
}
There may be a scenario (like loading multiple charts in one document or a single page app) where you need to manually disable a plug-in for a certain chart. To disable a plug-in, set its value in config.plugins
to null
. For example, to load a cross section chart with a time series chart:
import Chart from '@chartiq/react-components'
export default function MyTimeSeriesChart() {
return <Chart config={{ plugins: { crosssection: null } }} />
}
It is possible customize the web components that are rendered inside the Template.jsx files. To see an example, refer to ChartIQ React App README.
Additional documentation on web components in the ChartIQ library can be found at documentation.chartiq.com.
FAQs
React Components for ChartIQ library
The npm package @chartiq/react-components receives a total of 61 weekly downloads. As such, @chartiq/react-components popularity was classified as not popular.
We found that @chartiq/react-components demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.