@Envelope @ { ViewBag.Title="Receiving Indicator - Drying"; }
Receiving Indicator - Drying
@using (Html.BeginForm())
{
<p>
<div class="row">
<div class="col-md-2">
Produtor:
@Html.DropDownList("ProdutorId", null, "TODOS", htmlAttributes: new { @class = "form-control" })
</div>
<div class="col-md-2">
Destino:
@Html.DropDownList("DestinoMercadoId", null, "TODOS", htmlAttributes: new { @class = "form-control" })
</div>
<div class="col-md-2">
Variedade:
@Html.DropDownList("VariedadeId", null, "TODOS", htmlAttributes: new { @class = "form-control" })
</div>
<div class="col-md-2">
Ano:
<select id="ano" name="ano" class="form-control">
<option selected="selected" value="2018">2018</option>
<option selected="selected" value="2019">2019</option>
<option selected="selected" value="2020">2020</option>
<option selected="selected" value="2021">2021</option>
<option selected="selected" value="2022">2022</option>
<option selected="selected" value="2023">2023</option>
<option selected="selected" value="2024">2024</option>
<option selected="selected" value="2025">2025</option>
<option selected="selected" value="2026">2026</option>
<option selected="selected" value="2027">2027</option>
<option selected="selected" value="2028">2028</option>
<option selected="selected" value=""></option>
</select>
</div>
<div class="col-md-2">
Opções de relatório:
<select id="grafico" name="grafico" class="form-control">
<option selected="selected" value="1">Em PDF</option>
<option selected="selected" value="2">EM TELA</option>
</select>
</div>
<div class="col-md-2" style="margin-top: 20px;">
<input type="submit" value="Gerar Gráfico" class="btn btn-info" />
</div>
</div>
</p>
}
<table class="table table-bordered" style="width:940px; margin: 50px; margin-bottom:0px; margin-top: 0px">
<tr>
<th style=" width:77px; text-align:center">
@ViewBag.Janeiro
</th>
<th style="width:76px; text-align:center">
@ViewBag.Fevereiro
</th>
<th style="width:76px; text-align:center">
@ViewBag.Marco
</th>
<th style="width:77px; text-align:center">
@ViewBag.Abril
</th>
<th style="width:77px; text-align:center">
@ViewBag.Maio
</th>
<th style="width:77px; text-align:center">
@ViewBag.Junho
</th>
<th style="width:75px; text-align:center">
@ViewBag.Julho
</th>
<th style="width:76px; text-align:center">
@ViewBag.Agosto
</th>
<th style="width:76px; text-align:center">
@ViewBag.Setembro
</th>
<th style="width:77px; text-align:center">
@ViewBag.Outubro
</th>
<th style="width:77px; text-align:center">
@ViewBag.Novembro
</th>
<th style="width:94px; text-align:center">
@ViewBag.Dezembro
</th>
</tr>
</table>
@{
var nome = new[] { "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro" };
var valores = new List<double> { ViewBag.Janeiro, ViewBag.Fevereiro, ViewBag.Marco, ViewBag.Abril, ViewBag.Maio, ViewBag.Junho, ViewBag.Julho, ViewBag.Agosto, ViewBag.Setembro, ViewBag.Outubro, ViewBag.Novembro, ViewBag.Dezembro };
var barChart = new BarChart();
barChart.ChartConfiguration.ScaleBeginAtZero = true;
barChart.ComplexData.Labels.AddRange(nome);
barChart.ChartConfiguration.Animation = false;
barChart.ComplexData.Datasets.AddRange(new List<ComplexDataset>
{
new ComplexDataset
{
Data = valores,
Label = "Movimentação - Produtor",
FillColor = "rgb(0,100,0)",
StrokeColor = "rgb(0,100,0)",
PointColor = "rgb(0,100,0)",
PointStrokeColor = "#fff",
PointHighlightFill = "#fff",
PointHighlightStroke = "rgb(0,100,0)",
},
});
}
<canvas id="myCanvas" width="1000" height="400" chart-legend="true"></canvas>
@Html.CreateChart("myCanvas", barChart)
This is the graph I created, it works fine, but it does not set the total value of each bar above it, I've tried everything but it does not work, someone can give me a light