Graphical query handling via javascript [closed]

1

Good afternoon, I have a query on my system where it generates a graph.


Inthefirstcaptionofthegraphitislikeundefined,Iwastryingtoredomyqueryonlyitwasnotcomingwiththesamevalues.
Iwantedtoremovetheundefinedoptionthatisinmycaptionleaveonlythelastthreeoptionsinmychart.

Iwouldliketoknowifsomeonecanhelpmewithatreatmentviajavascript,I'llpostmycodebelow.
Controller.cs

[HttpPost]publicasyncTask<JsonResult>GetProcessosByDeslocamentoPedidoMedico(){SetaTipos();vardados=string.Empty;if(_tipo==2)dados=$"AND p.RegiaoId = {_dado}";
            else if (_tipo == 3)
                dados = $"AND p.UserId = {_dado}";

            var query = $@"SELECT Title, SUM(Count) AS Count
                        FROM (
                            SELECT
                            CASE WHEN EstadoId = EstadoIdAutor AND EstadoId = Meddoc1 AND EstadoId = Meddoc2 AND EstadoId = Meddoc3 THEN
                                 'Sem deslocamento'
                                 ELSE CASE WHEN EstadoId = EstadoIdAutor AND (EstadoId = Meddoc1 OR EstadoId = Meddoc2 OR EstadoId = Meddoc3) THEN
                                    'Fora de domicílio do autor'
                                    ELSE CASE WHEN EstadoId <> EstadoIdAutor OR (EstadoId = EstadoIdAutor AND (EstadoId <> Meddoc1 AND EstadoId <> Meddoc2 AND EstadoId <> Meddoc3)) THEN
                                        'Mais de um deslocamento'
                                    END
                                 END 
                            END AS Title,
                            COUNT(*) AS Count
                            FROM jud_Processos
                            WHERE Status = 1 AND Trancado = 1 {dados}
                            GROUP BY EstadoId, EstadoIdAutor, Meddoc1, Meddoc2, Meddoc3
                        ) Sub
                        GROUP BY Title;";

            var total = await _graficosService.GetProcessos(query);

            return Json(total, JsonRequestBehavior.AllowGet);
        }


My javascript


case "9":
  Post("GetProcessosByDeslocamentoPedidoMedico", "", text);
  break;


I wanted to remove the undefined option that is in my caption

    
asked by anonymous 18.09.2017 / 20:45

1 answer

0

You can filter the results with a higher query

SELECT TOP 3 * FROM (
SELECT Title, SUM(Count) AS Count
                        FROM (
                            SELECT
                            CASE WHEN EstadoId = EstadoIdAutor AND EstadoId = Meddoc1 AND EstadoId = Meddoc2 AND EstadoId = Meddoc3 THEN
                                 'Sem deslocamento'
                                 ELSE CASE WHEN EstadoId = EstadoIdAutor AND (EstadoId = Meddoc1 OR EstadoId = Meddoc2 OR EstadoId = Meddoc3) THEN
                                    'Fora de domicílio do autor'
                                    ELSE CASE WHEN EstadoId <> EstadoIdAutor OR (EstadoId = EstadoIdAutor AND (EstadoId <> Meddoc1 AND EstadoId <> Meddoc2 AND EstadoId <> Meddoc3)) THEN
                                        'Mais de um deslocamento'
                                    END
                                 END 
                            END AS Title,
                            COUNT(*) AS Count
                            FROM jud_Processos
                            WHERE Status = 1 AND Trancado = 1 {dados}
                            GROUP BY EstadoId, EstadoIdAutor, Meddoc1, Meddoc2, Meddoc3
                        ) Sub
                        GROUP BY Title
) TB_AUX;
    
18.09.2017 / 21:53