Skip to main content
Question

Custom view chart ignore particular filter/facet

  • 9 September 2024
  • 4 replies
  • 58 views

I have a chart on a custom view with a time series (x) and a geographic series as a stack. The visual uses the ctx context to change as per the filtered dataset. How can I stop the chart widget from reacting when a filter is made to the time series but still react when changing other filters?

<ods-dataset-context context="changeininvestmentswmca" changeininvestmentswmca-dataset="change-in-investments-wmca" changeininvestmentswmca-parameters="{'disjunctive.areaidentifier':true,'disjunctive.arealabel':true,'disjunctive.periodlabel':true}">
<ods-chart scientific-display="false" align-month="true">
<ods-chart-query context="changeininvestmentswmca" field-x="periodlabel" maxpoints="50" series-breakdown="arealabel">
<ods-chart-serie expression-y="value" chart-type="line" function-y="SUM" color="range-custom" scientific-display="true">
</ods-chart-serie>
</ods-chart-query>
</ods-chart>

</ods-dataset-context>

 

Auto-translation 🪄

J'ai un graphique sur une vue personnalisée avec une série chronologique (x) et une série géographique sous forme de pile. Le visuel utilise le contexte ctx pour changer en fonction de l'ensemble de données filtré. Comment puis-je empêcher le widget graphique de réagir lorsqu'un filtre est appliqué à la série chronologique, mais de réagir quand même lorsque j'ai modifié d'autres filtres ? 

Hello Dany,
 

You need to have another context than ctx to build the chart and then you can connect the ctx parameter for the field area with the new context. This will allow your new context to react to area parameter only. 

What this could look like :

changeininvestmentswmca.parametersr’refine.arealabel']=ctx.parameterst’refine.arealabel']
changeininvestmentswmca is filtered for the field arealabel exactly like ctx but not the others.

I hope this might helps you,

Best regards

Auto-translation 🪄

Bonjour Dany, Vous devez avoir un autre contexte que ctx pour construire le graphique et vous pouvez ensuite connecter le paramètre ctx pour le champ area avec le nouveau contexte. Cela permettra à votre nouveau contexte de réagir uniquement au paramètre area. À quoi cela pourrait ressembler : changeininvestmentswmca.parametersm’refine.arealabel']=ctx.parameters]’refine.arealabel'] changeininvestmentswmca est filtré pour le champ arealabel exactement comme ctx mais pas les autres. J'espère que cela pourra vous aider, Cordialement

Hi @Aubin  Im struggling to get the syntax right with what you added above. Would you be able to modify the supplied example to help me learn. I would be most appreciative.

Auto-translation 🪄

Bonjour @Aubin  J'ai du mal à comprendre la syntaxe avec ce que vous avez ajouté ci-dessus. Pourriez-vous modifier l'exemple fourni pour m'aider à apprendre. Je vous en serais très reconnaissant.

@Aubin I have finally got it working. Thank you for that. But I have another question. It appears I make a selection but it doesn't change the filters in real time. I must refresh the page in order to have it update the linked value. Is there any way around this?

Auto-translation 🪄

@Aubin J'ai enfin réussi à le faire fonctionner. Merci pour cela.  Mais j'ai une autre question. Il semble que je fasse une sélection mais cela ne change pas les filtres en temps réel. Je dois actualiser la page pour qu'elle mette à jour la valeur liée. Existe-t-il un moyen de contourner cela ?

Hello danny,

Firstly, I'm so sorry I didn’t see your answer just above.

If the filter is only working when you refresh the page I can suppose that you wrote the expression on ods-dataset-context parameters field or in a ng-init field. These expressions are read only once when the page loads. If you want to have it “in time” you need to write the expression outside a balise.

exemple following the upper exemple :

<ods-dataset-context context="changeininvestmentswmca" changeininvestmentswmca-dataset="change-in-investments-wmca" changeininvestmentswmca-parameters="{'disjunctive.areaidentifier':true,'disjunctive.arealabel':true,'disjunctive.periodlabel':true}">

  {{ my_expression ;””}}

<ods-chart scientific-display="false" align-month="true">

<ods-chart-query context="changeininvestmentswmca" field-x="periodlabel" maxpoints="50" series-breakdown="arealabel"> <ods-chart-serie expression-y="value" chart-type="line" function-y="SUM" color="range-custom" scientific-display="true">

</ods-chart-serie> </ods-chart-query> </ods-chart> </ods-dataset-context>

I hope this will help.

Auto-translation 🪄

Bonjour Danny,Tout d'abord, je suis vraiment désolé de ne pas avoir vu votre réponse juste au-dessus. Si le filtre ne fonctionne que lorsque vous actualisez la page, je peux supposer que vous avez écrit l'expression dans le champ paramètres ods-dataset-context ou dans un champ ng-init. Ces expressions ne sont lues qu'une seule fois lors du chargement de la page. Si vous souhaitez l'avoir « à temps », vous devez écrire l'expression en dehors d'une balise.exemple en suivant l'exemple ci-dessus :  

Reply