blob: e898a4a62ad2f37f5c41b315529ae13daa2805b9 [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 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Initial contribution:
* Loetz GmbH & Co. KG
*
*/
grammar org.eclipse.osbp.xtext.chart.ChartDSL with org.eclipse.osbp.xtext.oxtype.OXtype
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/xtext/action/ActionDSL" as action
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:
importSection=XImportSection?
packages+=ChartPackage*;
ChartPackage:
{ChartPackage} 'package' name=QualifiedName
(hasColors?='seriesColors' '{' (colors+=SeriesColor)* '}' )?
('fontFamily' defaultFontFamily=CanvasFontFamilyEnum)?
('{' (charts+=Chart)* '}' )?;
SeriesColor:
{SeriesColor} rgb=STRING;
Chart:
{Chart} 'chart' name=TRANSLATABLEID (description?='describedBy' descriptionValue=TRANSLATABLESTRING)?
'as' charttype=ChartOption
((selectById?='selectById')? & ('toolbar' toolbar=[action::ActionToolbar])?)
('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} 'upTo' numberIntervalValue=SignedNumber numberRange=ChartRangeElement;
ChartDatamart:
'datamart' datamartRef=[datamart::DatamartDefinition] '{' elements+=ChartElement* '}';
ChartElement:
ChartAxis | ChartLegend | ChartHighlighter;
ChartLegend:
{ChartLegend}
'legend'
(noLegend?='noLegend')?
(placement=LegendPlacementEnum (toggle?='toggle' replot?='replot' toggleType=ToggleTypeEnum)?)?
('fontSize' fontSize=INT)?
('textColor' textColor=STRING)?;
ChartHighlighter:
'tooltip' location=TooltipLocationEnum ((tooltipAlways?='always')? (insideChart?='inside')?);
ChartAxis:
'axis' axis=[datamart::DatamartAxis]
'renders' renderType=RenderTypeEnum
(shortLabel?='shortLabel')?
('labelAngle' labelAngle=SignedNumber)?
('labelFontSize' labelFontSize=INT)?
('labelTextColor' labelTextColor=STRING)?
('tickAngle' tickAngle=SignedNumber)?
('tickFontSize' tickFontSize=INT)?
('tickTextColor' tickTextColor=STRING)?;
ChartRangeElement:
ChartSegmentColor;
ChartSegmentColor:
'segmentcolor' rgb=STRING;
SignedNumber returns ecore::EInt:
('-'? INT)?;
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';
enum CanvasFontFamilyEnum:
DEFAULT='Default'|
ARIAL='Arial'|
VERDANA='Verdana'|
TIMESNEWROMAN='Times New Roman'|
COURIERNEW='Courier New'|
SERIF='serif'|
SANSERIF='sans-serif';