π¦ Installation Guide
Complete installation guide for GoCharting SDK across different environments and frameworks.
π System Requirements
Minimum Requirements
- Node.js: 16.0.0 or higher (for NPM installation)
- Browsers: Chrome 80+, Firefox 75+, Safari 13+, Edge 80+
- Memory: 512MB available RAM
- Network: Stable internet connection for real-time data
Recommended Requirements
- Node.js: 18.0.0 LTS or higher
- Memory: 1GB+ available RAM
- Network: Low-latency connection for trading applications
π Installation Methods
Method 1: NPM Package (Recommended)
Install via package manager for modern JavaScript applications:
npm install @gocharting/chart-sdkInstall peer dependencies:
npm install react react-dom luxonUsage:
import { createChart, DataProvider } from "@gocharting/chart-sdk";Method 2: CDN (Quick Start)
Load directly from CDN for rapid prototyping:
<!DOCTYPE html>
<html>
<head>
<title>GoCharting SDK</title>
</head>
<body>
<!-- Load GoCharting SDK -->
<script src="https://gocharting.com/sdk/library/demo-550e8400-e29b-41d4-a716-446655440000/index.umd.js"></script>
<script>
// SDK available as window.GoChartingSDK
const { createChart } = window.GoChartingSDK;
</script>
</body>
</html>Method 3: Download and Self-Host
Download and host the SDK files yourself:
- Download: Latest ReleaseΒ
- Extract: Unzip to your project directory
- Include: Add script tags to your HTML
<!-- Self-hosted version -->
<script src="/path/to/gocharting-sdk.min.js"></script>π§ Framework-Specific Installation
React Applications
Create React app (if needed):
npx create-react-app my-trading-app
cd my-trading-appInstall GoCharting SDK:
npm install @gocharting/chart-sdkInstall additional dependencies:
npm install axios luxonTypeScript Support:
npm install -D @types/react @types/react-domNext.js Applications
Create Next.js app (if needed):
npx create-next-app@latest my-trading-app
cd my-trading-appInstall GoCharting SDK:
npm install @gocharting/chart-sdkConfigure for SSR:
npm install dynamic-import-polyfillNext.js Configuration:
// next.config.js
module.exports = {
webpack: (config) => {
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
};
return config;
},
transpilePackages: ["gocharting-sdk"],
};π License Key Setup
Obtaining License Keys
- Demo License: Use
demo-550e8400-e29b-41d4-a716-446655440000(no registration required) - Professional License: Purchase at gocharting.com/pricingΒ
- Enterprise License: Contact sales@gocharting.com
Environment Variables
Set up environment variables for different environments:
# .env.development
REACT_APP_GOCHARTING_LICENSE=demo-550e8400-e29b-41d4-a716-446655440000
REACT_APP_API_BASE_URL=http://localhost:3001
# .env.production
REACT_APP_GOCHARTING_LICENSE=PROF-YOUR-PRODUCTION-KEY
REACT_APP_API_BASE_URL=https://api.yourcompany.comConfiguration Files
// config/gocharting.js
const config = {
development: {
licenseKey: "demo-550e8400-e29b-41d4-a716-446655440000",
apiBaseUrl: "http://localhost:3001",
},
production: {
licenseKey: process.env.GOCHARTING_LICENSE_KEY,
apiBaseUrl: process.env.API_BASE_URL,
},
};
export default config[process.env.NODE_ENV || "development"];π οΈ Build Configuration
Webpack Configuration
// webpack.config.js
module.exports = {
resolve: {
alias: {
"gocharting-sdk": path.resolve(
__dirname,
"node_modules/gocharting-sdk/dist"
),
},
},
externals: {
// Use external React for better bundle optimization
react: "React",
"react-dom": "ReactDOM",
},
optimization: {
splitChunks: {
cacheGroups: {
gocharting: {
test: /[\\/]node_modules[\\/]gocharting-sdk[\\/]/,
name: "gocharting",
chunks: "all",
},
},
},
},
};Vite Configuration
// vite.config.js
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
export default defineConfig({
plugins: [react()],
build: {
rollupOptions: {
external: ["react", "react-dom"],
output: {
globals: {
react: "React",
"react-dom": "ReactDOM",
},
},
},
},
optimizeDeps: {
include: ["gocharting-sdk"],
},
});Rollup Configuration
// rollup.config.js
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import { terser } from "rollup-plugin-terser";
export default {
input: "src/index.js",
output: {
file: "dist/bundle.js",
format: "umd",
name: "MyTradingApp",
globals: {
react: "React",
"react-dom": "ReactDOM",
"gocharting-sdk": "GoChartingSDK",
},
},
external: ["react", "react-dom", "gocharting-sdk"],
plugins: [resolve(), commonjs(), terser()],
};π Verification
Installation Verification
Create a simple test to verify installation:
// test-installation.js
import { createChart, DataProvider } from "@gocharting/chart-sdk";
console.log("GoCharting SDK loaded successfully!");
console.log("createChart:", typeof createChart);
console.log("DataProvider:", typeof DataProvider);
// Test basic instantiation
try {
const chart = createChart(document.createElement("div"), {
symbol: "TEST:SYMBOL",
interval: "1D",
licenseKey: "demo-550e8400-e29b-41d4-a716-446655440000",
datafeed: {
getBars: () => ({ bars: [], meta: { noData: true } }),
resolveSymbol: (symbolName, onResolve) =>
onResolve({ ticker: symbolName }),
searchSymbols: (userInput, callback) => callback([]),
},
});
console.log("β
SDK installation verified");
} catch (error) {
console.error("β SDK installation failed:", error);
}Browser Console Test
Open browser console and run:
// Check if SDK is loaded
console.log("GoCharting SDK:", window.GoChartingSDK);
// Test basic functionality
if (window.GoChartingSDK) {
const { ProfessionalChart } = window.GoChartingSDK;
console.log("β
SDK available globally");
} else {
console.error("β SDK not loaded");
}π Troubleshooting
Common Issues
1. Module not found error
Error: Cannot resolve module 'gocharting-sdk'Solution:
# Clear cache and reinstall
rm -rf node_modules package-lock.jsonnpm install2. React version conflicts
Error: Multiple versions of React detectedSolution:
npm install react@18.2.0 react-dom@18.2.0 --exact3. Build errors with bundlers
Error: Cannot resolve 'fs' moduleSolution:
// Add to webpack config
resolve: {
fallback: {
"fs": false,
"path": false
}
}4. License key errors
Error: Invalid license keySolution:
- Verify license key format
- Check domain restrictions
- Ensure key is not expired
Getting Help
If you encounter issues:
- Check Documentation: gocharting.com/sdk/docsΒ
- Search Issues: github.com/gocharting/sdk/issuesΒ
- Community Support: gocharting.com/discordΒ
- Email Support: support@gocharting.com
π Next Steps
After successful installation:
- Quick Start Guide - Build your first chart
- API Reference - Explore available methods
- Examples - See framework-specific implementations
- Configuration - Customize chart behavior
Installation complete? Letβs build something amazing! π