BPCharts

    long/short/net chart image

Table of Contents

  1. Overview
  2. Getting Started
  3. Colors (chco)
  4. Fonts and Font Sizes (chft and chfts)
  5. Fills (chf)
  6. Grid Lines (chgx)
  7. Axis Label Styles (chxs)
  8. Axis Label Gap (chxlg)


Overview

The long-short-net chart is a horizontal, overlapping bar chart used to display the long, short and net asset allocation positions in an investment or in a portfolio of investments.

The chart type code for the line chart is lsn.



Getting Started

Description Image

Bar values are drawn top to bottom, right to left.

For historical reasons, the long-short-net chart displays dotted vertical grid lines by default. This can be controlled via Grid Lines (chgx). All future examples on this page will have grid lines explicitly turned off using chgx=.


chd=t:250,-150|0,-30|80,-10|
10,-70|20,0
Missing values are not allowed. Use 0 if no value is available for either a long or short position.

chd=t:250,-150|0,-30|80,-10|
10,-70|20,0
As with all charts, the chart size is controllable using the chs parameter.

chs=100x50
As with all charts, you can generate other image types using the chof parameter.

chof=s
(SVG)


Colors (chco)

You must select the colors of individual bars using the chco option.

See also Colors.

Syntax

chco=<color_1>|...|<color_n>
<color>
The color, in RRGGBB or RRGGBBAA format, to apply to the bar.

Example

Description Image
Standard Morningstar asset allocation colors.

chco=547598|A40046|E88B1C|
9FA617|7EB0CD
Make the bar at the top red (FF0000), the bar second from the top green (00FF00), the bar third from the top blue (0000FF), the bar fourth from the top yellow (FFFF00) and the bottom bar cyan (00FFFF).

chco=FF0000|00FF00|0000FF|
FFFF00|00FFFF


Fonts and Font Sizes (chft and chfts)

The fonts that BPCharts uses to renders labels can be controlled using the chft (font name) and chfts (font size) options.

For raster (e.g. PNG) charts, only fonts which exist on the BPCharts server may be used. For vector (e.g. SVG) charts, the font does not need to exist on the BPCharts server but the client which renders the SVG must have the font installed.

Syntax

chft=<font_name>
chfts=<font_size>
<font_name>
The name of the font to use to render the chart. Defaults to Verdana.
<font_size>

The size of the font to use to render the chart. For raster charts (e.g. PNG) this is in pixels; for vector charts (e.g. SVG) this is in points.

For raster charts, defaults to 11 pixels tall. For vector charts, defaults to 8 points tall.

Example

Description Image
Draw the axis labels in 18-pixel-tall Times New Roman.

chft=Times New Roman
chfts=18


Fills (chf)

The background color of the chart can be controlled using the chart fill option.

Syntax

chf=<fill_type>,s,<color>
<fill_type>

The part of the chart being filled. Specify one of the following values:

  • bg - Background fill
s
Indicates a solid fill.
<color>
The fill color, in RRGGBB or RRGGBBAA format.

Example

Description Image
Set the background of the chart to blue (0000FF). chf=bg,s,0000ff


Grid Lines (chgx)

You can control the chart grid lines using the chgx option.

chgx stands for axis-aligned grid lines. For the long-short-net chart, vertical grid-lines are drawn every 25% For historical reasons, the long-short-net chart displays dotted vertical grid lines by default.

Syntax

chgx=<axis>,<opt_dash_length>,<opt_space_length>,<opt_color>,<opt_thickness>
     |...|
     <axis>,<opt_dash_length>,<opt_space_length>,<opt_color>,<opt_thickness>
<axis>

The axis with whose major interval you want the grid lines synchronized.

  • y - Vertical grid lines aligned at each 25% allocation.
<opt_dash_length>,<opt_space_length>
[Optional] Used to define dashed grid lines. The first parameter is the length of each line dash. The second parameter is the spacing between dashes. Specify 0 for <opt_space_length> for a solid line. Default values are 1,1.
<opt_color>
[Optional] The color, in RRGGBBAA format, of the grid lines. Defaults to black (000000)
<opt_thickness>
[Optional] The thickness of the grid lines. Defaults to 1.

Example

Description Image
Default grid lines

none (equiv: chgx=y,1,1,000000,1)
Turn off all grid lines.

chgx=
Draw a chart with solid vertical grid axis lines.

chgx=y,1,0,000000,1
Draw a chart with solid gray (CCCCCC) vertical axis lines.

chgx=y,1,0,CCCCCC,1
Draw a chart with 3-pixel-thick dashed red (FF0000) vertical grid lines.

chgx=y,1,1,FF0000,3


Axis Label Styles (chxs)

You can control the style of individual axis labels by using the chxs option.

Syntax

chxs=<axis_index>,<label_color>,<font_size>,<alignment>,<tick>,<tick_color>,<opt_font_style>
     |...|
     <axis_index>,<label_color>,<font_size>,<alignment>,<tick>,<tick_color>,<opt_font_style>
<axis_index>
The axis to which this applies.
<label_color>
Needs to be specified in RRGGBB or RRGGBBAA format.
<font_size>
Needs to be specified.
<alignment>
Needs to be -1. No other values can be parsed.
<tick>
Needs to be specified. Not implemented.
<tick_color>
Needs to be specified. Not implemented.
<opt_font_style>
Sets the Fontstyle. R for regular, B for bold, S for Strikeout, U for Underline, I for Italic. Not case sensitive.
Description Image
Draw the bottom axis labels in large red underlined font
chxs=0,FF0000,12,-1,t,000000,U


X Axis Label Gap (chxlg)

The chxlg option allows you to manually specify the gap between the labels for an axis and the axis itself.

Syntax

chxlg=<axis_1>,<gap_1>
      |...|
      <axis_n>,<gap_n>
     
<axis>

Display the axis, using the following axis codes:

  • x - X-Axis on the bottom of the chart
<gap>
The gap, in pixels for raster formats and points for vector formats, between the axis labels and the axis.

Example

Description Image
Create a 20-pixel gap between the labels of the x-axis on the bottom of the chart and the chart itself.

chxlg=x,20