veritatisquam
Version:
Carbon charting components, lerna monorepo
141 lines (108 loc) • 3.7 kB
text/typescript
import marked from 'marked';
export const angularTutorial = {
name: 'Angular',
type: 'getting-started',
content: marked(`
The Carbon Charts Angular library provides a collection of reusable charting components to build websites
and user interfaces. Adopting the library enables developers to use consistent markup, styles, and behavior
in prototype and production work.
[](https://carbon-design-system.github.io/carbon-charts/angular)
**with yarn:**
\`\`\`bash
yarn add @carbon/charts-angular d3@5.x
\`\`\`
**with npm:**
\`\`\`bash
npm install --save @carbon/charts-angular d3@5.x
\`\`\`
**Note:** you'd also need to install \`carbon-components\` if you're not using a bundled version of the library.
To start using the \`StackedBarChart\` component, try the example below:
\`\`\`ts
import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { ChartsModule } from "@carbon/charts-angular";
import { AppComponent } from "./app.component";
@NgModule({
imports: [BrowserModule, ChartsModule],
declarations: [AppComponent],
bootstrap: [AppComponent],
})
export class AppModule {}
\`\`\`
\`\`\`html
<ibm-stacked-bar-chart
class="n-chart"
[]="stackedBarData"
[]="stackedBarOptions"
></ibm-bar-chart>
\`\`\`
\`\`\`ts
import { Component } from "@angular/core";
import "@carbon/charts/styles.css";
@Component({
selector: "my-app",
templateUrl: "./app.component.html",
styleUrls: ["./app.component.css"],
})
export class AppComponent {
stackedBarData = [
// refer to tabular data format tutorial
];
stackedBarOptions = {
// refer to chart specific options
};
}
\`\`\`
Data follows the same model in all charts.
See tutorial on tabular data format for more information on chart data.
You can see the default options for all charts
[](https://github.com/carbon-design-system/carbon-charts/tree/master/packages/core/src/configuration.ts).
+ **[Storybook - Demos](https://carbon-design-system.github.io/carbon-charts/angular)**
+ **[Storybook - Story Sources](https://github.com/carbon-design-system/carbon-charts/tree/master/packages/angular/stories)**
+ **[Storybook - Data & options used](https://github.com/carbon-design-system/carbon-charts/tree/master/packages/core/demo/data)**
Please refer to the
[](https://www.carbondesignsystem.com/data-visualization/chart-types)
on using the different charts available in this library.
Please refer to the
[](https://github.com/carbon-design-system/carbon-charts/blob/master/CONTRIBUTING.md)
before starting any work.
We recommend the use of [Angular Storybook](https://github.com/storybookjs/storybook/tree/next/app/angular)
for developing components.
**Start the server:**
\`\`\`bash
cd packages/angular
yarn storybook
\`\`\`
Open browser to \`http://localhost:9005\`
View available components [here](https://github.com/carbon-design-system/carbon-charts#component-status)
If you experience any issues while getting set up with Carbon Charts, please head over to the
[](https://github.com/carbon-design-system/carbon-charts) for more guidelines and support.
Please [create an issue](https://github.com/carbon-design-system/carbon-charts/issues) if your issue
does not already exist.
`),
};