Problem/Motivation

The Chart module uses deprecated Google Charts API that will be closed on April 25.

Proposed resolution

We have considered many possible alternatives and decided to go with Visualization API since it's used in 8.x version of Yandex.Metrics and our guys are somehow familiar with it.

Other solutions considered (just for future reference):

  1. Charts module. We're not familiar with it.
  2. Chart module. No guaranties that it will be upgraded to new API.
  3. d3.js module. Much work. We wouldn't depend on third-party HTTP calls.
  4. D3.js (directly). Much more work. We wouldn't depend on third-party HTTP calls and third-party modules.
  5. Own chart rendering solution. Huge amount of work. We wouldn't depend on anything.

Comparison of Charting modules

Comments

Konstantin Komelin’s picture

Issue summary: View changes
Konstantin Komelin’s picture

Issue summary: View changes
Konstantin Komelin’s picture

Issue summary: View changes
Konstantin Komelin’s picture

Issue summary: View changes
Konstantin Komelin’s picture

Issue summary: View changes
Konstantin Komelin’s picture

Issue summary: View changes
Niremizov’s picture

As it seems to me installing another dependency module (with Update Manager) is simpler than adding external library manually. So Visualization looks Ok, but as I remember there is some troubles with rendering charts on Ajax call.

Pierre.Vriens’s picture

Hey buddies over here!

Thought I'd add a few items to your considerations, which might help for you to decide:

  • It is the "google API" (charting library) that is announced by Google to be depreciated in April 2015.
  • "I" am working (hard ...) on coming up with at least a quick win within the chart module, prior to that deadline, so that the chart module will use the (new) Google Charts, the same as is used by the charts module. To achieve minimal impact for all (25K+) site users, I want to do so with a release upgrade that only contains the fixes to swap to the new google library. So your users should only have to apply that minimal upgrade (the current chart release will be marked "unsupported" then, to draw attention to the required release upgrade). The goal is to do so for both D6 (still!) and D7 (of course).
  • That quickwin should give me time to work on the longer-term enhancements within chart. My ambition is to continue to support the existing chart array structure, though new features (like support for the D3.JS library!) may require extending that structure.
  • You are correct about the Visualization API, and indeed "it doesn't look stable right now" (which you know is being discussed in our "common issue" over there).
  • What I don't seem to see in your considerations is the charts module. That is commonly perceived by chart and charts maintainers as "the best migration path" from chart to chart, for anybody (like you here?) considering working on "a solution" to address the April deadline. Mostly because the array structure between the 2 modules is fairly similar. Note: the current dev version of charts (= RC1 + quite some fixes) is very stable, and actually close to soon being released (I hope).
  • Moreover, be aware of the #2 recommendation of our common Visualization API issue. I personally fully agree to that recommendation there (= work on merging the module with charts module). If you ask me, and if I indeed become the owner of that module, it will be one of my long term goals to merge those modules somehow.

With all this in mind, if I was in your shoes to decide, I would consider this shortlist as options to pick from:

  1. Go without a dependency on any of the charting modules (not "my recommendation" as you know, but it is an option where you have full control over everything).
  2. Rework your current chart usage into its equivalent charts usage (to avoid the current risk of the Visualisation API which is only alfa for now).
  3. Do nothing, and continue with the chart module, waiting for that quickwin I described (obviously that assumes you trust that my quickwin is indeed going to make it "on time", that's your current risk of course).

Voilà, just my 2 cents of input to help you in your decision process, OK? I'm curious which route you're going to go for, keep me informed please.

PS 1: let's think positive about this challenge, there HAS to be a way to get this resolved on time, don't you think? A pitty it has taken so long to get something moving in charting-land in Drupal, but may I say "at least I got something going ..."? Of course it would help if "other people" would be willing to start helping/contributing, because for quite some months it has been a pretty lonely road in the direction of my "Chart 2.0" target.

PS 2: consider slightly rewording the title of your issue (it is not the 'chart API', but the "Google Image Charts library")

Konstantin Komelin’s picture

Thanks Pierre. I will read your comment attentively when I have time.

For now:

PS 2: consider slightly rewording the title of your issue (it is not the 'chart API', but the "Google Image Charts library")

From the official documentation:

The Google Chart API lets you dynamically generate charts with a URL string.

https://developers.google.com/chart/image/

I'm not going to waste time for somebody's perfectionism.

-- Konstantin

Konstantin Komelin’s picture

Priority: Normal » Major
Issue tags: +yandex_metrics-7.x-3.x
Niremizov’s picture

C Visualization API, вариант есть, но мне надо больше времени и это потребует переработать модуль Visualization API.

Возможно перенести ту часть кода, который отвечает за подгрузку графиков через AJAX, прямо в Visualization API. Т.е. будет достаточно просто указать что мы хотим вывести график, а данные можно взять из такого-то URL.

  $chart = array(
    '#chart_id' => 'chart_sources',
    '#title' => chart_title(t('Traffic Sources'), '000000', 15),
    '#type' => CHART_TYPE_PIE,
    '#size' => chart_size(500, 200),
    '#adjust_resolution' => TRUE,
    '#data_url' => 'admin/yandex_metrics_ajax_data/12354/week/genre'
  );
theme('chart', array('chart' => $chart))

Где 'admin/yandex_metrics_ajax_data/12354/week/genre' - будет возвращать данные счетчика в JSON формате.

kalabro’s picture

Do we really need AJAX loading in Yandex Metrics reports? Can we refactor yandex_metrics-7.x-3.x instead to use current Visualization API?

Konstantin Komelin’s picture

Видимо вы не читаете скайп-чат.

Приведу цитату:

Поговорили с Катей голосом. Вот к чему пришли:
1) Думаем пока только о 7-ой версии модуля Метрики, остальное сейчас не важно.
2) Самым безболезненным будет переход на Charts (по словам Пьери). Катя постарается оценить время на интеграцию с Charts
3) При замене на другой модуль чартов, модуль метрики получит новый мажорный релиз 7.x-3.0
4) Выпиливание вьюхи Популярное Содержимое идет с низким приоритетом и войдет в новый релиз, только если будет время на эту задачу.

Создал тег для нового релиза https://www.drupal.org/project/issues/search?issue_tags=yandex_metrics-7...

Konstantin Komelin’s picture

C Visualization API, вариант есть, но мне надо больше времени и это потребует переработать модуль Visualization API.

Мы ищем быстрый и простой вариант как помочь юзерам 7-ой версии. Визуализейшн - это сложно, поэтому смотрим на Charts.

Do we really need AJAX loading in Yandex Metrics reports?

No, we don't.

Konstantin Komelin’s picture

Can we refactor yandex_metrics-7.x-3.x instead to use current Visualization API?

Just reminder. You and I decided to concentrate on Charts.

Niremizov’s picture

Если AJAX не нужен, то и действий дополнительных не нужно... Так что Visualization, можно использовать прямо как есть. Я могу создать отдельную ветку чтобы Вы посмотрели, ок или не ок...

Konstantin Komelin’s picture

Да Никит, было бы супер!
Я создал ветку 7.x-3.x (но лучше, наверное, потестить на какой-то другой, можешь создать временно)

Тут же главное, чтобы нам не пришлось сильно переделывать код для графиков.

Pierre.Vriens’s picture

A pity quite a few recent comments require some language skills I do not have. No worries though, I assume anything relevant "for me" will eventually show up somewhere in a language I am moe comfortable with.

Konstantin Komelin’s picture

Sorry Pierre for using Russian in comments. For some guys it is the only way to go in the conditions of extreme urgency.
To summarize our discussion above, we are choosing between Charts and Visualization and trying to estimate effort needed.
I think we will let you know once we make the final decision.

Thanks,
Konstantin

Niremizov’s picture

http://cgit.drupalcode.org/yandex_metrics/commit/?id=0b47478

Может излишне много кода убрал, а так работает, вроде.

Konstantin Komelin’s picture

Issue summary: View changes
StatusFileSize
new213.9 KB
new145.93 KB

Thank you Nikita. It seems like Visualization and new Google API make more things with less code required.
Attached screenshots of Chart and Visualization reports. As you can see, Hourly Traffic doesn't work for some reasons.

Konstantin Komelin’s picture

Status: Active » Needs work
Konstantin Komelin’s picture

Title: Chart API is going to be deprecated: what to do? » Replace Chart module with Visualization
Issue summary: View changes
Related issues: +#2368793: Chart 2.0, +#2042155: Looking for new co-maintainers

Updated the issue description to reflect our latest considerations and decisions.

Konstantin Komelin’s picture

Issue summary: View changes
Konstantin Komelin’s picture

For Visualization maintainers:
I've tested dev version, it works fine for me. Please consider possibility to release beta1 ? You might want to start collecting feedback from non-tech users as early as possible.

  • Niremizov committed 8b5f1a2 on 2446451-vis
    #2446451 Updated gender_label generation.
    
Niremizov’s picture

Hourly Trafic graph does not properly work because of $1913416 issue.

Niremizov’s picture

Commit 5be0af2 Hourly Traffic visit info number rounded.
Ok, hourly traffic graph have been fixed for now. #1913416 - issue also fixed.

Suppose, I'm done with Yandex.Metrics, now going to fixes Visualization API issues.

Konstantin Komelin’s picture

Status: Needs work » Needs review

Thank you Nikita for your efforts. You've done a great job. It's important for us and our users.

I've tested your change. It works like a charm :)

Kate, can you also take a look and then we'll ask Nikita to push to 7.x-3.x?

Best,
Konstantin

  • Niremizov committed 8b5f1a2 on 7.x-3.x
    #2446451 Updated gender_label generation.
    
Konstantin Komelin’s picture

Status: Needs review » Fixed

We look forward to a new Visualization release to fix dependency.

Niremizov’s picture

There is only one bug left - https://www.drupal.org/node/1915362 to make Visualization API release.
This 'sorting' trouble needs a bit of Christophe assist, I have send him a mail, after he response I would try to resolve this in short time.

Niremizov’s picture

Fixed, would be greate if someone would test Visualization API module...

Pierre.Vriens’s picture

Nikita, great work you seem to have been doing, for this module, but also for the Visualization module (yes I saw all those issue updates you performed there!). In French we say "Chapeau!" (= heads off for you).

I'd like to refer to this issue within the documentation of the chart module (and possibly also in teh visualization docu), to provide samples of other modules who have changed there chart dependency to another module. But by looking at this issue, I've problems (of course) with the various comments that are not in English. Therefor this request for you (or maybe Konstantin?): can you add 1 extra comment please (in English) which summarizes what in the end you had to do? If possible with a patch attached also to illustrate the actual lines you had to change.

Thank you in advance for doing so!

PS: after I finish fighting the chart deadline of april 2015, I plan to work on enhancing the visualization docu. If I'm to decide on that, I would like it to become similar (its topics and structure) to what is now available for charts, and for chart (both are still in a kind of work-in-progress though).

Konstantin Komelin’s picture

Version: 7.x-2.x-dev » 7.x-3.x-dev
Niremizov’s picture

Ok Pierre, I would place required code lines here: https://www.drupal.org/node/1830042 or right here https://www.drupal.org/node/2448311 - And than you could edit it as you wish.

(This would happen on this or next week.)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.