@namespace Connected.Components
@using System.Globalization;
@inherits Chart

<svg @attributes="CustomAttributes" class="chart-line mud-ltr" width="@ChartParent?.Width" height="@ChartParent?.Height" viewBox="0 0 650 350">
    <g class="charts-grid">
        <g class="charts-gridlines-yaxis">
            @foreach (var horizontalLine in _horizontalLines)
            {
                <path stroke="#e0e0e0" stroke-width="0.3" d="@horizontalLine.Data"></path>
            }
        </g>
        @if (ChartParent?.ChartOptions.XAxisLines==true)
        {
            <g class="charts-gridlines-xaxis-lines">
                @foreach (var verticalLine in _verticalLines)
                {
                    <path stroke="gray" stroke-width="0.3" d="@verticalLine.Data"></path>
                }
            </g>
        }
    </g>
    <g class="charts-yaxis">
        @foreach (var horizontalLineValue in _horizontalValues)
        {
            @((MarkupString)$"<text x='{horizontalLineValue.X.ToString(CultureInfo.InvariantCulture)}' y='{horizontalLineValue.Y.ToString(CultureInfo.InvariantCulture)}' font-size='12px' text-anchor='end' dominant-baseline='auto'>{horizontalLineValue.Value.ToString(CultureInfo.InvariantCulture)}</text>")
        }
    </g>
    <g class="charts-xaxis">
        @foreach (var verticalLineValue in _verticalValues)
        {
            @((MarkupString)$"<text x='{verticalLineValue.X.ToString(CultureInfo.InvariantCulture)}' y='{verticalLineValue.Y.ToString(CultureInfo.InvariantCulture)}' font-size='12px' text-anchor='middle'>{verticalLineValue.Value.ToString(CultureInfo.InvariantCulture)}</text>")
        }
    </g>
    <g class="charts-line-series">
        @foreach (var chartLine in _chartLines)
        {
            <path class="chart-line" @onclick="() => SelectedIndex = chartLine.Index"  fill="none" stroke="@(ChartParent.ChartOptions.ChartPalette.GetValue(chartLine.Index % ChartOptions.ChartPalette.Count()))" stroke-width="@(ChartParent.ChartOptions.LineStrokeWidth)" d="@chartLine.Data"></path>
        }
    </g>

	@ChartParent?.CustomGraphics
</svg>
<Legend Data="@_legends" />
