Click or drag to resize
IQueryRunnerColumnChart Method
Creates a column chart.

Namespace:  C2ExplorerServiceStack.Logic.Interfaces
Assembly:  C2ExplorerServiceStack.Logic (in C2ExplorerServiceStack.Logic.dll) Version: 1.0
Syntax
C#
IC2HighChart ColumnChart(
	string titleText,
	string categoriesSeriesName,
	string dataSeriesName,
	string[] categories,
	decimal[] series,
	string subtitleText = "",
	bool spline = true,
	C2ExplorerThemeName themeName = C2ExplorerThemeName.DarkUnica,
	bool navigator = false
)

Parameters

titleText
Type: SystemString
Chart title.
categoriesSeriesName
Type: SystemString
Name of the categories series.
dataSeriesName
Type: SystemString
Name of the data series.
categories
Type: SystemString
Array of categories names.
series
Type: SystemDecimal
The data series.
subtitleText (Optional)
Type: SystemString
The subtitle text.
spline (Optional)
Type: SystemBoolean
if set to true a spline curve will be added to the chart.
themeName (Optional)
Type: C2ChartsLibrary.EnumsC2ExplorerThemeName
Name of the theme.
navigator (Optional)
Type: SystemBoolean
if set to true the chart will have a navigator.

Return Value

Type: IC2HighChart
A chart object
Examples
Column chart
// Show numbers of systems trading a different sets of instruments.

var stocks = (from trade in C2TRADES where trade.Instrument == "stock" select trade.SystemId).Distinct();
var forex = (from trade in C2TRADES where trade.Instrument == "forex" select trade.SystemId).Distinct();
var futures = (from trade in C2TRADES where trade.Instrument == "future" select trade.SystemId).Distinct();
var options = (from trade in C2TRADES where trade.Instrument == "option" select trade.SystemId).Distinct();

IColumnChart chart = new ColumnChart("Systems and instruments", "Instruments", "Systems count");

chart.Add("Stocks", stocks.Count());
chart.Add("Forex", forex.Count());
chart.Add("Futures", futures.Count());
chart.Add("Options", options.Count());
chart.Add("Stocks & Forex", stocks.Intersect(forex).Count());
chart.Add("Stocks & Futures", stocks.Intersect(futures).Count());
chart.Add("Stocks & Options", stocks.Intersect(options).Count());
chart.Add("Forex & Futures", forex.Intersect(futures).Count());
chart.Add("Forex & Options", forex.Intersect(options).Count());
chart.Add("Futures & Options", futures.Intersect(options).Count());
chart.Add("Stk & Frx & Ftrs", stocks.Intersect(forex).Intersect(futures).Count());
chart.Add("Stk & Frx & Optns", stocks.Intersect(forex).Intersect(options).Count());
chart.Add("Stk & Ftrs & Optns", stocks.Intersect(futures).Intersect(options).Count());
chart.Add("Frx & Ftrs & Optns", forex.Intersect(futures).Intersect(options).Count());
chart.Add("All instruments", stocks.Intersect(forex).Intersect(futures).Intersect(options).Count());

CHART = chart;

/* 
// A different way: 

String[] categoriesNames = new String[15] { "Stocks", "Forex", "Futures", "Options", 
                                            "Stocks & Forex", "Stocks & Futures", "Stocks & Options", 
                                            "Forex & Futures", "Forex & Options", "Futures & Options", 
                                            "Stk & Frx & Ftrs", "Stk & Frx & Optns", "Stk & Ftrs & Optns", "Frx & Ftrs & Optns", 
                                            "All instruments" };
Decimal[] data = new Decimal[15] {
                stocks.Count(), 
                forex.Count(), 
                futures.Count(), 
                options.Count(),
                stocks.Intersect(forex).Count(),
                stocks.Intersect(futures).Count(),
                stocks.Intersect(options).Count(),
                forex.Intersect(futures).Count(),
                forex.Intersect(options).Count(),
                futures.Intersect(options).Count(),
                stocks.Intersect(forex).Intersect(futures).Count(),
                stocks.Intersect(forex).Intersect(options).Count(),
                stocks.Intersect(futures).Intersect(options).Count(),
                forex.Intersect(futures).Intersect(options).Count(),
                stocks.Intersect(forex).Intersect(futures).Intersect(options).Count()
            };

CHART = ColumnChart("Systems and instruments", "Instruments", "Systems count", categoriesNames, data);*/
See Also