blob: b1de8c89cea4cc4c6b8ea1ae632a8bc99cb10381 [file] [log] [blame]
/*
*
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Initial contribution:
* Loetz GmbH & Co. KG
*
*/
grammar org.eclipse.osbp.xtext.chart.ChartDSL with org.eclipse.xtext.xbase.annotations.XbaseWithAnnotations
import "http://osbp.eclipse.org/xtext/chart/ChartDSL"
import "http://osbp.eclipse.org/xtext/datamartdsl/DatamartDSL" as datamart
import "http://osbp.eclipse.org/xtext/cubedsl/CubeDSL" as cube
import "http://osbp.eclipse.org/dsl/common/types/v1" as types
import "http://osbp.eclipse.org/dsl/entity/v1" as entity
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
ChartModel:
packages+=ChartPackage*;
ChartPackage:
{ChartPackage} 'package' name=QualifiedName ('{' (imports+=ChartImport)* (charts+=Chart)* '}' )?;
Chart:
{Chart} 'chart' name=TRANSLATABLEID (description?='described by' descriptionValue=TRANSLATABLESTRING)? 'as' charttype=ChartOption (polling?='polling' pollingTime=INT)? ('using' source=ChartDatamart)?;
ChartOption:
ChartBar | ChartLine | ChartPie | ChartDonut | ChartBubble | ChartGauge | ChartTree;
ChartBar:
{ChartBar} 'bar' ((shadow?='shaded')? & (animated?='animated')? & (swapped?='swapped')? & (stacked?='stacked')?);
ChartLine:
{ChartLine} 'line' ((animated?='animated')? & (showMarker?='showMarker')? & (trendLine?='trendLine')? & (cursor?='cursor' (zoom?='zoom')? (tooltip?='tooltip')?)? & (fillToZero?='fillZero')? & (fillArea?='filled')?);
ChartPie:
{ChartPie} 'pie' (empty?='empty')?;
ChartDonut:
{ChartDonut} 'donut';
ChartBubble:
{ChartBubble} 'bubble' ((multiplier?='multiplier' multiplierValue=Number)? & ((gradient?='gradient') | (transparent?='transparent')))?;
ChartGauge:
{ChartGauge} 'gauge' ((labeled?='label' labelValue=STRING)? & (hasTicks?='hasTicks' 'minimum' minValue=INT 'maximum' maxValue=INT)? & (hasIntervals?='intervals' '{' (intervals+=ChartInterval)* '}')?);
ChartTree:
{ChartTree} 'tree' ((map?='map') | (collapsible?='collapsible'));
ChartInterval:
ChartNumberInterval;
ChartNumberInterval:
{ChartNumberInterval} 'up to' numberIntervalValue=SignedNumber numberRange=ChartRangeElement;
ChartDatamart:
'datamart' datamartRef=[datamart::DatamartDefinition] '{' elements+=ChartElement* '}';
ChartElement:
ChartAxis | ChartLegend | ChartHighlighter;
ChartLegend:
'legend' placement=LegendPlacementEnum (toggle?='toggle' replot?='replot' toggleType=ToggleTypeEnum)?;
ChartHighlighter:
'tooltip' location=TooltipLocationEnum ((tooltipAlways?='always')? (insideChart?='inside')?);
ChartAxis:
'axis' axis=[datamart::DatamartAxis] 'renders' renderType=RenderTypeEnum (shortLabel?='shortLabel')? ('tickangle' angle=SignedNumber)?;
ChartRangeElement:
ChartSegmentColor;
ChartSegmentColor:
'segmentcolor' rgb=STRING;
ChartImport returns types::LImport:
'import' importedNamespace=ChartQualifiedNameWithWildCard;
//SignedNumber returns ecore::EDouble:
// '-'? Number;
SignedNumber returns ecore::EInt:
('-'? INT)?;
ChartQualifiedNameWithWildCard:
QualifiedName ('.' '*')?;
TRANSLATABLESTRING: STRING;
TRANSLATABLEID:
ID;
enum LegendPlacementEnum:
INSIDE='inside' | INSIDE_GRID='inside-grid' | OUTSIDE='outside' | OUTSIDE_GRID='outside-grid';
enum ToggleTypeEnum:
NORMAL='normal' | SLOW='slow' | FAST='fast';
enum TooltipLocationEnum:
NORTH='north' | NORTH_EAST='north-east' | EAST='east' | SOUTH_EAST='south-east' | SOUTH='south' | SOUTH_WEST='south-west' | WEST='west' | NORTH_WEST='north-west';
enum RenderTypeEnum:
CATEGORY='category' | LINEAR='linear' | DATE='date' | LOG='logarithmic' |PYRAMID='pyramid';