Why Use D3?

The /D3 command enables you to create sophisticated data visualizations with simple natural language commands. Perfect for:

  • Visualizing sales and revenue trends
  • Analyzing customer behavior patterns
  • Monitoring KPIs and metrics
  • Creating executive dashboards
  • Exploring market data
  • Presenting financial analysis

Basic Usage

Use the command followed by the description of the chart you want. Give it reference to a dataset. It’s usually better to first prepare the data in a previous step and then use the data in the D3 command (versus trying to do it all in one step).

/D3 create stacked bar chart showing the sales pipeline by region and stage using csvOutput from the previous step

For this example, I loaded a CSV in the first step and output it to a variable called csvOutput.

Simple Examples

Time Series Analysis

/D3 create line chart using QUARTERLY_RESULTS, plot time on x-axis and profit_margin on y-axis

Comparative Analysis

/D3 create grouped bar chart using REGIONAL_SALES, show regions on x-axis and sales_volume on y-axis, group by product_category

Distribution Analysis

/D3 create histogram using CUSTOMER_DATA, show purchase_amount distribution with 20 bins

Part-to-Whole Analysis

/D3 create pie chart using MARKET_SHARE, show market_segment proportions with percentage labels

Advanced Examples

Multi-Metric Dashboard

/D3 create dashboard using SALES_METRICS
- panel 1: line chart showing daily_revenue trend
- panel 2: bar chart comparing regional_performance
- panel 3: donut chart showing product_mix
- panel 4: area chart displaying customer_growth

Interactive Business Analysis

/D3 create interactive scatter plot using CUSTOMER_METRICS
x-axis: customer_lifetime_value
y-axis: acquisition_cost
size: number_of_purchases
color: customer_segment
add hover tooltips with customer_satisfaction

Complex Time Analysis

/D3 create multi-line chart using FINANCIAL_DATA
plot last_12_months
show metrics: revenue, costs, profit
add trend lines
include monthly moving average

Hierarchical Data Visualization

/D3 create treemap using DEPARTMENT_BUDGET
size by annual_spend
color by budget_variance
show department_hierarchy
add interactive drill-down

What Can D3 Do?

D3 offers an extensive range of visualization capabilities suited for business analytics. See documenation here: https://d3js.org/what-is-d3 and an amazing interactive example here: https://observablehq.com/@d3/gallery

Standard Business Charts

  • Line charts for trend analysis
  • Bar charts (vertical, horizontal, grouped, stacked)
  • Pie and donut charts for composition analysis
  • Area charts for cumulative trends
  • Scatter plots for correlation analysis
  • Bubble charts for multi-dimensional data

Advanced Visualizations

  • Heat maps for performance matrices
  • Tree maps for hierarchical data
  • Sunburst diagrams for multi-level breakdowns
  • Network graphs for relationship mapping
  • Sankey diagrams for flow analysis
  • Radar charts for comparative metrics
  • Box plots for statistical distribution

Interactive Features

  • Zoom and pan capabilities
  • Interactive tooltips
  • Click-through drilling
  • Dynamic filtering
  • Animated transitions
  • Real-time updates
  • Cross-chart filtering
  • Custom legends and annotations

Business Intelligence Features

  • Trend line overlays
  • Moving averages
  • Statistical annotations
  • Threshold indicators
  • Forecast projections
  • Confidence intervals
  • Outlier detection
  • Benchmark comparisons

Layout Options

  • Multi-chart dashboards
  • Responsive sizing
  • Custom color schemes
  • Corporate branding integration
  • Export capabilities
  • Mobile optimization
  • Accessible design features

Tips for Best Results

  1. Be specific about your data source and desired metrics
  2. Specify any required filtering or data transformations
  3. Include desired interactive features in your command
  4. Mention any specific styling or branding requirements
  5. Indicate if you need specific annotations or overlays

Remember that D3 can handle various data formats and can create both simple and complex visualizations. The key is to be clear about your data and visualization goals in your command.

Saving and Sharing Your D3 Charts

You can save and share your D3 visualizations in two simple steps:

  1. First, create your visualization in one step.

  2. Then, save it to global file storage in a subsequent step.

The /filestorage command will return a shareable link that you can send to colleagues. They can view and interact with your visualization directly through this link, making it easy to:

  • Include visualizations in presentations
  • Share insights with stakeholders
  • Embed charts in internal documentation
  • Archive important analytical views
  • Collaborate on data analysis

Pro tip: Add descriptive names when saving your visualizations to make them easier to find and understand later.

Iterating

When you get into complex datasets and visualizations, Pinkfish may not get it right the first time. In these cases, you’ll need to have a conversation with Pinkfish to get it right. Here’s an example where I used a CSV with customer data and asked Pinkfish to display customers on a map. It took a few iterations to get it right.

Step 1: describe the data in preparation for the D3 command

what's in customers-100.csv 

Step 2, try #1 (resulted in a csv parsing error):

/D3 show customers countries highlighted on a map with a list of the customer names that show on rollover of their country. 
Use dataset /customers-100.csv which has this structure ->structure (reference to step1.structure) 
And here is some sample data ->sampleRows (reference to step1.sampleRows) for your reference.

Step 2, try #2 (success)

add in /CSV skill to do a better job at parsing. 

Step 3: write to filestorage:

/filestorage write the result from the previous step to "customersByCountry"