﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<StiSerializer version="1.02" type="Net" application="StiReport">
  <Dictionary Ref="1" type="Dictionary" isKey="true">
    <BusinessObjects isList="true" count="0" />
    <Databases isList="true" count="0" />
    <DataSources isList="true" count="1">
      <ModRecommendation Ref="2" type="DataTableSource" isKey="true">
        <Alias>ModRecommendation</Alias>
        <Columns isList="true" count="5">
          <value>Time,System.DateTime</value>
          <value>Value,System.Decimal</value>
          <value>Currency,System.String</value>
          <value>Target,System.Double</value>
          <value>Key,System.Int32</value>
        </Columns>
        <Dictionary isRef="1" />
        <Name>ModRecommendation</Name>
        <NameInSource>OwnTable</NameInSource>
      </ModRecommendation>
    </DataSources>
    <Relations isList="true" count="0" />
    <Report isRef="0" />
    <Variables isList="true" count="16">
      <value>,debug1,debug1,System.String,,False,False</value>
      <value>Input</value>
      <value>Input,ViewId,ViewId,System.String,BC8G.DE,False,False</value>
      <value>Input,GraphPriceLineColor,GraphPriceLineColor,System.String,,False,False</value>
      <value>Input,GraphIndexLineColor,GraphIndexLineColor,System.String,,False,False</value>
      <value>Input,GraphPriceLineThickness,GraphPriceLineThickness,System.Int32,_x0032_,False,False</value>
      <value>Input,GraphIndexLineThickness,GraphIndexLineThickness,System.Int32,_x0032_,False,False</value>
      <value>Input,GraphLineShadow,GraphLineShadow,System.String,false,False,False</value>
      <value>Input,Days,Days,System.Int32,_x0037_20,False,False</value>
      <value>Internal</value>
      <value>Internal,IMin,IMin,System.Double,_x0030_,False,False</value>
      <value>Internal,IMax,IMax,System.Double,_x0030_,False,False</value>
      <value>Internal,PMin,PMin,System.Double,_x0030_,False,False</value>
      <value>Internal,PMax,PMax,System.Double,,False,False</value>
      <value>Input,Source,Source,System.String,Reuters,False,False</value>
      <value>Input,ShortId,ShortId,System.String,O2Dn,False,False</value>
    </Variables>
  </Dictionary>
  <EngineVersion>EngineV2</EngineVersion>
  <GlobalizationStrings isList="true" count="0" />
  <MetaTags isList="true" count="0" />
  <Pages isList="true" count="1">
    <Page1 Ref="3" type="Page" isKey="true">
      <BeforePrintEvent>initOurSource();
//MessageBox.Show("Aufgerufen!!!");

Stimulsoft.Report.Chart.StiChart chart = Chart1; // sender as Stimulsoft.Report.Chart.StiChart;
             
double dMax = double.MinValue;
double dMin = double.MaxValue;
double spacing;
int stepcount;


foreach (DataRow row in ModRecommendation.DataTable.Rows) {
    if (row["Value"] != DBNull.Value) {
	  dMin = Math.Min(System.Convert.ToDouble(row["Value"]), dMin);
	  dMax = Math.Max(System.Convert.ToDouble(row["Value"]), dMax);
    }
    if (row["Target"] != DBNull.Value) {
	  dMin = Math.Min(System.Convert.ToDouble(row["Target"]), dMin);
	  dMax = Math.Max(System.Convert.ToDouble(row["Target"]), dMax);
    }
}

spacing=((dMax-dMin)*0.1);
((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).YAxis.Range.Minimum = dMin-spacing&lt;0?0:Math.Floor(dMin-spacing);
((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).YAxis.Range.Maximum = Math.Ceiling(dMax+spacing);
((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).YAxis.Range.Auto = false;
//((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).YAxis.Labels.Step = (float)Math.Ceiling((dMax-dMin)/3); //((Math.Ceiling(dMax+spacing) - Math.Floor(dMin-spacing))/3);
//MessageBox.Show(Math.Ceiling(dMax+spacing).ToString());
//MessageBox.Show(Math.Floor(dMin-spacing).ToString());
//MessageBox.Show(((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).YAxis.Labels.Step.ToString());
int rowcount=ModRecommendation.Rows.Count;
((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).XAxis.Labels.Format="yyyy";
stepcount=261;
if (rowcount&lt;650)
{
	((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).XAxis.Labels.Format="MMM.yyyy";
//	((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).XAxis.Labels.Step=0;
//	((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).XAxis.Ticks.Step=0;
	stepcount=rowcount/8;
}
if (rowcount&lt;279)
{
	((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).XAxis.Labels.Format="MMM.yyyy";
	stepcount=31;
}
if (rowcount&lt;10)
{
	((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).XAxis.Labels.Format="dd.MMM.yyyy";
	stepcount=rowcount/4;
}
((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).XAxis.Labels.Step=stepcount;
((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).XAxis.Ticks.Step=stepcount;
</BeforePrintEvent>
      <Border>None;Black;2;Solid;False;4;Black</Border>
      <Brush>Transparent</Brush>
      <Components isList="true" count="2">
        <Chart1 Ref="4" type="Stimulsoft.Report.Chart.StiChart" isKey="true">
          <AllowApplyStyle>False</AllowApplyStyle>
          <Area Ref="5" type="Stimulsoft.Report.Chart.StiClusteredColumnArea" isKey="true">
            <BorderColor>Gray</BorderColor>
            <Brush>White</Brush>
            <Chart isRef="4" />
            <GridLinesHor Ref="6" type="Stimulsoft.Report.Chart.StiGridLinesHor" isKey="true">
              <Area isRef="5" />
              <Color>Silver</Color>
              <MinorColor>Gainsboro</MinorColor>
            </GridLinesHor>
            <GridLinesHorRight Ref="7" type="Stimulsoft.Report.Chart.StiGridLinesHor" isKey="true">
              <Area isRef="5" />
              <Color>Silver</Color>
              <MinorColor>Gainsboro</MinorColor>
              <Visible>False</Visible>
            </GridLinesHorRight>
            <GridLinesVert Ref="8" type="Stimulsoft.Report.Chart.StiGridLinesVert" isKey="true">
              <Area isRef="5" />
              <Color>100, 95, 72, 29</Color>
              <MinorColor>100, 95, 72, 29</MinorColor>
              <MinorStyle>Solid</MinorStyle>
              <MinorVisible>True</MinorVisible>
            </GridLinesVert>
            <InterlacingHor Ref="9" type="Stimulsoft.Report.Chart.StiInterlacingHor" isKey="true">
              <Area isRef="5" />
              <InterlacedBrush>Transparent</InterlacedBrush>
            </InterlacingHor>
            <InterlacingVert Ref="10" type="Stimulsoft.Report.Chart.StiInterlacingVert" isKey="true">
              <Area isRef="5" />
              <InterlacedBrush>Transparent</InterlacedBrush>
              <Visible>False</Visible>
            </InterlacingVert>
            <XAxis Ref="11" type="Stimulsoft.Report.Chart.StiXBottomAxis" isKey="true">
              <Area isRef="5" />
              <DateTimeStep Ref="12" type="Stimulsoft.Report.Chart.StiAxisDateTimeStep" isKey="true">
                <NumberOfValues>0</NumberOfValues>
              </DateTimeStep>
              <Interaction Ref="13" type="Stimulsoft.Report.Chart.StiAxisInteraction" isKey="true" />
              <Labels Ref="14" type="Stimulsoft.Report.Chart.StiAxisLabels" isKey="true">
                <Antialiasing>False</Antialiasing>
                <Color>Black</Color>
                <Font>MetaKorrespondenz,8,Regular,Point,False,0</Font>
                <Format>yyyy</Format>
                <TextAlignment>Left</TextAlignment>
              </Labels>
              <LineColor>Gray</LineColor>
              <Range Ref="15" type="Stimulsoft.Report.Chart.StiAxisRange" isKey="true" />
              <ShowEdgeValues>True</ShowEdgeValues>
              <StartFromZero>False</StartFromZero>
              <Ticks Ref="16" type="Stimulsoft.Report.Chart.StiAxisTicks" isKey="true" />
              <Title Ref="17" type="Stimulsoft.Report.Chart.StiAxisTitle" isKey="true">
                <Color>Black</Color>
                <Direction>LeftToRight</Direction>
                <Font>Tahoma,12,Bold</Font>
              </Title>
            </XAxis>
            <XTopAxis Ref="18" type="Stimulsoft.Report.Chart.StiXTopAxis" isKey="true">
              <Area isRef="5" />
              <Interaction Ref="19" type="Stimulsoft.Report.Chart.StiAxisInteraction" isKey="true" />
              <Labels Ref="20" type="Stimulsoft.Report.Chart.StiAxisLabels" isKey="true">
                <Color>Black</Color>
                <Font>Tahoma,8</Font>
              </Labels>
              <LineColor>Gray</LineColor>
              <Ticks Ref="21" type="Stimulsoft.Report.Chart.StiAxisTicks" isKey="true" />
              <Title Ref="22" type="Stimulsoft.Report.Chart.StiAxisTitle" isKey="true">
                <Color>Black</Color>
                <Direction>LeftToRight</Direction>
                <Font>Tahoma,12,Bold</Font>
              </Title>
            </XTopAxis>
            <YAxis Ref="23" type="Stimulsoft.Report.Chart.StiYLeftAxis" isKey="true">
              <AllowApplyStyle>False</AllowApplyStyle>
              <Area isRef="5" />
              <Interaction Ref="24" type="Stimulsoft.Report.Chart.StiAxisInteraction" isKey="true" />
              <Labels Ref="25" type="Stimulsoft.Report.Chart.StiAxisLabels" isKey="true">
                <AllowApplyStyle>False</AllowApplyStyle>
                <Antialiasing>False</Antialiasing>
                <Color>Black</Color>
                <Font>MetaKorrespondenz,8,Regular,Point,False,0</Font>
              </Labels>
              <LineColor>Gray</LineColor>
              <Range Ref="26" type="Stimulsoft.Report.Chart.StiAxisRange" isKey="true" />
              <StartFromZero>False</StartFromZero>
              <Ticks Ref="27" type="Stimulsoft.Report.Chart.StiAxisTicks" isKey="true" />
              <Title Ref="28" type="Stimulsoft.Report.Chart.StiAxisTitle" isKey="true">
                <Color>Transparent</Color>
                <Direction>BottomToTop</Direction>
                <Font>Arial,8</Font>
                <Text>Price [EUR]/Ratings</Text>
              </Title>
            </YAxis>
            <YRightAxis Ref="29" type="Stimulsoft.Report.Chart.StiYRightAxis" isKey="true">
              <AllowApplyStyle>False</AllowApplyStyle>
              <Area isRef="5" />
              <Interaction Ref="30" type="Stimulsoft.Report.Chart.StiAxisInteraction" isKey="true" />
              <Labels Ref="31" type="Stimulsoft.Report.Chart.StiAxisLabels" isKey="true">
                <Color>Transparent</Color>
                <Font>Tahoma,8</Font>
                <TextAlignment>Left</TextAlignment>
              </Labels>
              <LineColor>Transparent</LineColor>
              <Range Ref="32" type="Stimulsoft.Report.Chart.StiAxisRange" isKey="true" />
              <Ticks Ref="33" type="Stimulsoft.Report.Chart.StiAxisTicks" isKey="true">
                <Visible>False</Visible>
              </Ticks>
              <Title Ref="34" type="Stimulsoft.Report.Chart.StiAxisTitle" isKey="true">
                <Color>Black</Color>
                <Direction>TopToBottom</Direction>
                <Font>Tahoma,12,Bold</Font>
              </Title>
            </YRightAxis>
          </Area>
          <Brush>GradientBrush,White,[184:219:240],270</Brush>
          <ClientRectangle>0,0,132.3,45</ClientRectangle>
          <Conditions isList="true" count="0" />
          <ConstantLines isList="true" count="0" />
          <CustomStyleName />
          <DataRelationName isNull="true" />
          <DataSourceName>ModRecommendation</DataSourceName>
          <FilterOn>False</FilterOn>
          <Filters isList="true" count="0" />
          <Legend Ref="35" type="Stimulsoft.Report.Chart.StiLegend" isKey="true">
            <BorderColor>95, 72, 29</BorderColor>
            <Brush>GradientBrush,[255:255:255],[255:242:199],90</Brush>
            <Chart isRef="4" />
            <Font>Arial,8</Font>
            <LabelsColor>95, 72, 29</LabelsColor>
            <MarkerSize>10, 10</MarkerSize>
            <TitleColor>95, 72, 29</TitleColor>
            <TitleFont>Arial,14,Bold</TitleFont>
            <Visible>False</Visible>
          </Legend>
          <Name>Chart1</Name>
          <Page isRef="3" />
          <Parent isRef="3" />
          <ProcessChartEvent>//Stimulsoft.Report.Chart.StiChart chart = sender as Stimulsoft.Report.Chart.StiChart;
//Stimulsoft.Report.Chart.StiSeries series = (StiSeries)chart.Series[0];
//Stimulsoft.Report.Chart.StiSeries series1 = (StiSeries)chart.Series[1];
//             
//double dMax = double.MinValue;
//double dMin = double.MaxValue;
//double spacing;
//int stepcount;
//
//foreach (double d in series.Values)
//{
//	dMin = Math.Min(d, dMin);
//    dMax = Math.Max(d, dMax);
//}
//if (Target.Rows.Count&gt;0)
//	foreach (double? d in series1.Values)
//	{
//		if (d != null) {
//          dMin = Math.Min(d.Value, dMin);
//      	  dMax = Math.Max(d.Value, dMax);
//        }
//	}
//spacing=((dMax-dMin)*0.1);
//((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).YAxis.Range.Minimum = dMin-spacing&lt;0?0:Math.Floor(dMin-spacing);
//((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).YAxis.Range.Maximum = Math.Ceiling(dMax+spacing);
//((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).YAxis.Range.Auto = false;
//
//int rowcount=ModRecommendation.Rows.Count;
//((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).XAxis.Labels.Format="yyyy";
//stepcount=261;
//if (rowcount&lt;650)
//{
//	((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).XAxis.Labels.Format="MMM.yyyy";
////	((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).XAxis.Labels.Step=0;
////	((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).XAxis.Ticks.Step=0;
//	stepcount=rowcount/8;
//}
//if (rowcount&lt;279)
//{
//	((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).XAxis.Labels.Format="MMM.yyyy";
//	stepcount=31;
//}
//if (rowcount&lt;10)
//{
//	((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).XAxis.Labels.Format="dd.MMM.yyyy";
//	stepcount=rowcount/4;
//}
//((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).XAxis.Labels.Step=stepcount;
//((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).XAxis.Ticks.Step=stepcount;
//
////((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).YRightAxis.Range.Minimum = -1;
////((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).YRightAxis.Range.Maximum = 4;
////((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).YRightAxis.Range.Auto = false;</ProcessChartEvent>
          <Series isList="true" count="2">
            <Item4 Ref="36" type="Stimulsoft.Report.Chart.StiAreaSeries" isKey="true">
              <AllowApplyStyle>False</AllowApplyStyle>
              <ArgumentDataColumn>ModRecommendation.Time</ArgumentDataColumn>
              <Brush>Silver</Brush>
              <BrushNegative>Firebrick</BrushNegative>
              <Chart isRef="4" />
              <Filters isList="true" count="0" />
              <Lighting>False</Lighting>
              <LineColor>Silver</LineColor>
              <LineColorNegative>Firebrick</LineColorNegative>
              <LineMarker Ref="37" type="Stimulsoft.Report.Chart.StiLineMarker" isKey="true">
                <BorderColor>44, 0, 0</BorderColor>
                <Brush>[244:167:103]</Brush>
              </LineMarker>
              <LineWidth>1</LineWidth>
              <Marker Ref="38" type="Stimulsoft.Report.Chart.StiMarker" isKey="true">
                <BorderColor>94, 17, 0</BorderColor>
                <Brush>[255:217:153]</Brush>
                <Visible>False</Visible>
              </Marker>
              <SeriesLabels Ref="39" type="Stimulsoft.Report.Chart.StiCenterAxisLabels" isKey="true">
                <BorderColor>95, 72, 29</BorderColor>
                <Brush>Wheat</Brush>
                <Chart isRef="4" />
                <Font>Arial,7</Font>
                <LabelColor>95, 72, 29</LabelColor>
                <MarkerSize>8, 6</MarkerSize>
                <ValueType>Argument</ValueType>
                <ValueTypeSeparator>-</ValueTypeSeparator>
              </SeriesLabels>
              <ShowNulls>False</ShowNulls>
              <ShowSeriesLabels>None</ShowSeriesLabels>
              <ShowShadow>False</ShowShadow>
              <SortBy>Argument</SortBy>
              <Title>Price [EUR]/Ratings</Title>
              <TopmostLine>False</TopmostLine>
              <TopN Ref="40" type="Stimulsoft.Report.Chart.StiSeriesTopN" isKey="true" />
              <TrendLine Ref="41" type="Stimulsoft.Report.Chart.StiTrendLineNone" isKey="true">
                <LineColor>Black</LineColor>
                <ShowShadow>True</ShowShadow>
              </TrendLine>
              <ValueDataColumn>ModRecommendation.Value</ValueDataColumn>
            </Item4>
            <Item5 Ref="42" type="Stimulsoft.Report.Chart.StiLineSeries" isKey="true">
              <AllowApplyStyle>False</AllowApplyStyle>
              <ArgumentDataColumn>ModRecommendation.Time</ArgumentDataColumn>
              <AutoSeriesKeyDataColumn>ModRecommendation.Key</AutoSeriesKeyDataColumn>
              <Chart isRef="4" />
              <Filters isList="true" count="0" />
              <Lighting>False</Lighting>
              <LineColor>Blue</LineColor>
              <LineColorNegative>Firebrick</LineColorNegative>
              <LineMarker Ref="43" type="Stimulsoft.Report.Chart.StiLineMarker" isKey="true">
                <BorderColor>81, 0, 0</BorderColor>
                <Brush>[255:190:115]</Brush>
              </LineMarker>
              <LineWidth>1</LineWidth>
              <Marker Ref="44" type="Stimulsoft.Report.Chart.StiMarker" isKey="true">
                <BorderColor>131, 40, 0</BorderColor>
                <Brush>[255:240:165]</Brush>
                <Visible>False</Visible>
              </Marker>
              <SeriesLabels Ref="45" type="Stimulsoft.Report.Chart.StiCenterAxisLabels" isKey="true">
                <BorderColor>95, 72, 29</BorderColor>
                <Brush>Wheat</Brush>
                <Chart isRef="4" />
                <Font>Arial,7</Font>
                <LabelColor>95, 72, 29</LabelColor>
                <MarkerSize>8, 6</MarkerSize>
                <ValueTypeSeparator>-</ValueTypeSeparator>
              </SeriesLabels>
              <ShowInLegend>False</ShowInLegend>
              <ShowNulls>False</ShowNulls>
              <ShowShadow>False</ShowShadow>
              <Title>Series 1</Title>
              <TopN Ref="46" type="Stimulsoft.Report.Chart.StiSeriesTopN" isKey="true" />
              <TrendLine Ref="47" type="Stimulsoft.Report.Chart.StiTrendLineNone" isKey="true">
                <LineColor>Black</LineColor>
                <ShowShadow>True</ShowShadow>
              </TrendLine>
              <ValueDataColumn>ModRecommendation.Target</ValueDataColumn>
            </Item5>
          </Series>
          <SeriesLabels Ref="48" type="Stimulsoft.Report.Chart.StiNoneLabels" isKey="true">
            <Chart isRef="4" />
            <MarkerSize>8, 6</MarkerSize>
            <ValueType>Argument</ValueType>
            <ValueTypeSeparator>-</ValueTypeSeparator>
          </SeriesLabels>
          <SeriesLabelsConditions isList="true" count="0" />
          <Sort isList="true" count="0" />
          <Strips isList="true" count="0" />
          <Style Ref="49" type="Stimulsoft.Report.Chart.StiStyle01" isKey="true" />
          <Table Ref="50" type="Stimulsoft.Report.Chart.StiChartTable" isKey="true">
            <Font>Tahoma,8</Font>
            <GridLineColor>95, 72, 29</GridLineColor>
            <TextColor>95, 72, 29</TextColor>
          </Table>
          <Title Ref="51" type="Stimulsoft.Report.Chart.StiChartTitle" isKey="true">
            <Brush>[95:72:29]</Brush>
            <Font>Tahoma,12,Bold</Font>
          </Title>
        </Chart1>
        <txtYAxis Ref="52" type="Text" isKey="true">
          <Brush>Transparent</Brush>
          <ClientRectangle>1.5,6,4,32</ClientRectangle>
          <Conditions isList="true" count="0" />
          <Font>MetaBook-Roman,7.5</Font>
          <HorAlignment>Center</HorAlignment>
          <Margins>0,0,0,0</Margins>
          <Name>txtYAxis</Name>
          <Page isRef="3" />
          <Parent isRef="3" />
          <Text>Price / Price Target [EUR]</Text>
          <TextBrush>Black</TextBrush>
          <TextOptions>HotkeyPrefix=None, LineLimit=False, RightToLeft=False, Trimming=None, WordWrap=False, Angle=90, FirstTabOffset=40, DistanceBetweenTabs=20,</TextOptions>
          <Type>Expression</Type>
        </txtYAxis>
      </Components>
      <Conditions isList="true" count="0" />
      <Guid>f40cf960569f4adfb705ea71f71cddf8</Guid>
      <Margins>0,0,0,0</Margins>
      <Name>Page1</Name>
      <Orientation>Landscape</Orientation>
      <PageHeight>45</PageHeight>
      <PageWidth>132.3</PageWidth>
      <PaperSize>A4</PaperSize>
      <Report isRef="0" />
      <Watermark Ref="53" type="Stimulsoft.Report.Components.StiWatermark" isKey="true">
        <Font>Arial,100</Font>
        <TextBrush>[50:0:0:0]</TextBrush>
      </Watermark>
    </Page1>
  </Pages>
  <PrinterSettings Ref="54" type="Stimulsoft.Report.Print.StiPrinterSettings" isKey="true" />
  <ReferencedAssemblies isList="true" count="9">
    <value>System.Dll</value>
    <value>System.Drawing.Dll</value>
    <value>System.Windows.Forms.Dll</value>
    <value>System.Data.Dll</value>
    <value>System.Xml.Dll</value>
    <value>System.Core.Dll</value>
    <value>Stimulsoft.Controls.Dll</value>
    <value>Stimulsoft.Base.Dll</value>
    <value>Stimulsoft.Report.Dll</value>
  </ReferencedAssemblies>
  <ReportAlias>Report</ReportAlias>
  <ReportChanged>9/2/2013 10:31:35 AM</ReportChanged>
  <ReportCreated>12/18/2012 7:33:54 PM</ReportCreated>
  <ReportFile>F:\transfer\Problem.mrt</ReportFile>
  <ReportGuid>54c2d5867ca14673a60c2bc3387e0845</ReportGuid>
  <ReportName>Report</ReportName>
  <ReportUnit>Millimeters</ReportUnit>
  <ReportVersion>2013.1.1512</ReportVersion>
  <Script>using System;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.IO;
using Stimulsoft.Controls;
using Stimulsoft.Base.Drawing;
using Stimulsoft.Report;
using Stimulsoft.Report.Dialogs;
using Stimulsoft.Report.Components;
using Stimulsoft.Report.Chart;

namespace Reports
{
	public class Report : Stimulsoft.Report.StiReport
	{
		public Report()        {
			this.InitializeComponent();
		}
		
		private void initOurSource() {

			DataTable tblResult = new DataTable("ModRecommendation");
			tblResult.Columns.Add("Time", typeof(DateTime));
			tblResult.Columns.Add("Value", typeof(decimal));
			tblResult.Columns.Add("Currency", typeof(string));
			tblResult.Columns.Add("Target", typeof(double));
			tblResult.Columns.Add("Key", typeof(int));

			int i=-1;
			int cnt=0;
			DataTable tblSrc=null;
			DataTable recSrc=null;
			object recomm;
			bool stopmsg=false;
			DataRow row=null;
			int keycnt=-1;
			
			try
			{
				string dir= Path.GetDirectoryName(this.ReportFile);
				tblSrc = new DataTable();
				tblSrc.ReadXml(dir + @"\PriceTarget.xml");
				recSrc = new DataTable();
				recSrc.ReadXml(dir + @"\Target.xml");
				
				object val = tblSrc.Rows[0]["Target"];
				if( ( val == null
					|| val == DBNull.Value
					|| (val as string) == "")
					&amp;&amp; recSrc.Rows.Count &gt; 0 )
				{
					DateTime value=System.Convert.ToDateTime(tblSrc.Rows[0]["Time"]);
					DataRow src=recSrc.Rows.OfType&lt;DataRow&gt;().Where(j=&gt;(DateTime)j["Time"]&lt;value).OrderBy(j=&gt;(DateTime)j["Time"]).FirstOrDefault();
					if(src == null || src.IsNull("Value") || System.Convert.ToDouble(src["Value"])&lt;0)
						recomm=DBNull.Value;
					else
						recomm=src["Value"];
					i++;
				}
				else
					recomm = DBNull.Value;
				cnt=tblSrc.Rows.Count;
				keycnt=i;
			
				for(int j=0;j&lt;cnt-1;j++)
				{
					row=tblSrc.Rows[j];
					if (!row.IsNull("Target"))
					{
						recomm = row[3];
						if(System.Convert.ToDouble(row[3])&lt;0)
						{
							recomm=DBNull.Value;
							keycnt=-1;
							i++;
						}
						else
							keycnt=i;
						
					}					
					tblResult.Rows.Add(row["TIME"],row["VALUE"],row["Currency"],recomm,keycnt);			
				}
			}
			catch(Exception ex)
			{
				if(!stopmsg)
				{
					MessageBox.Show(ex.Message);
					stopmsg=true;
				}
			}

			RegData(tblResult);
			ModRecommendation.Connect();
		}
		
		private static Color _defaultColor = Color.Black;

		private void SetColor(IStiSeries series, string colorString) {
			try {
				if ((series is IStiBaseLineSeries) &amp;&amp; !string.IsNullOrEmpty(colorString)) {
					if (colorString.Contains("0x")) {
						(series as IStiBaseLineSeries).LineColor = Color.FromArgb(System.Convert.ToInt32(colorString, 16));
					}	else {
						Color color = Color.FromName(colorString);
						if (color.ToArgb() != 0) {
							(series as IStiBaseLineSeries).LineColor = color;
						}
					}
				} 
			} catch {}
		}
		
		private void SetLineTickness(IStiSeries series, int lineWidth) {
			if (series is IStiBaseLineSeries) {
				(series as IStiBaseLineSeries).LineWidth = lineWidth;
			}
		}
			
		#region StiReport Designer generated code - do not modify
		#endregion StiReport Designer generated code - do not modify
	}
}
</Script>
  <ScriptLanguage>CSharp</ScriptLanguage>
  <Styles isList="true" count="0" />
</StiSerializer>