remove win rate plot legendsmoother loading of champion detail
Some checks are pending
ci / docker (push) Waiting to run
Some checks are pending
ci / docker (push) Waiting to run
This commit is contained in:
parent
eb5e1cf41d
commit
c09c4a0664
@ -11,7 +11,6 @@ const ChampionWinRate = {
|
|||||||
const data = {
|
const data = {
|
||||||
labels: patches,
|
labels: patches,
|
||||||
datasets: [{
|
datasets: [{
|
||||||
label: 'Win rate',
|
|
||||||
data: winRateValues,
|
data: winRateValues,
|
||||||
fill: false,
|
fill: false,
|
||||||
borderColor: 'rgb(75, 192, 192)',
|
borderColor: 'rgb(75, 192, 192)',
|
||||||
@ -20,10 +19,20 @@ const ChampionWinRate = {
|
|||||||
};
|
};
|
||||||
this.chart = new Chart(document.getElementById("win-rate"), {
|
this.chart = new Chart(document.getElementById("win-rate"), {
|
||||||
type: 'line',
|
type: 'line',
|
||||||
data: data
|
data: data,
|
||||||
|
options: {
|
||||||
|
plugins: {
|
||||||
|
legend: {
|
||||||
|
display: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
this.chart.canvas.parentNode.style.height = '250px';
|
this.chart.canvas.parentNode.style.height = '250px';
|
||||||
this.chart.canvas.parentNode.style.width = '400px';
|
this.chart.canvas.parentNode.style.width = '400px';
|
||||||
|
this.chart.labels.display = false;
|
||||||
|
this.chart.options.legend.display = false
|
||||||
|
this.chart.options.legend.display = false
|
||||||
}, 1000)
|
}, 1000)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -75,6 +75,9 @@ defmodule LoLAnalyticsWeb.ChampionLive.Show do
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
@spec handle_async(:get_items | :get_summoners | :get_win_rates, {:ok, any()}, map()) ::
|
||||||
|
{:noreply, map()}
|
||||||
def handle_async(:get_win_rates, {:ok, result}, socket) do
|
def handle_async(:get_win_rates, {:ok, result}, socket) do
|
||||||
{:noreply, push_event(socket, "win-rate", %{winRates: result})}
|
{:noreply, push_event(socket, "win-rate", %{winRates: result})}
|
||||||
end
|
end
|
||||||
|
@ -2,6 +2,11 @@
|
|||||||
.win-rate {
|
.win-rate {
|
||||||
height: 250px;
|
height: 250px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.win-rate-container {
|
||||||
|
width: 100%;
|
||||||
|
height: 250px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<.header>
|
<.header>
|
||||||
@ -15,7 +20,9 @@
|
|||||||
<div class="flex flex-row gap-4">
|
<div class="flex flex-row gap-4">
|
||||||
<.champion_avatar class="w-20" id={@champion.id} name={@champion.name}
|
<.champion_avatar class="w-20" id={@champion.id} name={@champion.name}
|
||||||
image={"https://ddragon.leagueoflegends.com/cdn/14.11.1/img/champion/#{@champion.image}"} />
|
image={"https://ddragon.leagueoflegends.com/cdn/14.11.1/img/champion/#{@champion.image}"} />
|
||||||
|
<div class="win-rate-container">
|
||||||
<canvas class="w-full win-rate" height="250" class="win-rate" id="win-rate" phx-hook="ChampionWinRate" />
|
<canvas class="w-full win-rate" height="250" class="win-rate" id="win-rate" phx-hook="ChampionWinRate" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="my-4" />
|
<div class="my-4" />
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user